Decompiled source of WickedRingRevived v1.0.5

WickedRingRevived.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG;
using HG.Reflection;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("WickedRingRevived")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WickedRingRevived")]
[assembly: AssemblyTitle("WickedRingRevived")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace WickedRingRevived;

internal class ContentPacks : IContentPackProvider
{
	internal ContentPack contentPack = new ContentPack();

	public string identifier => "com.phreel.wickedringrevived";

	public void Initialize()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
	}

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

	public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
	{
		contentPack.identifier = identifier;
		List<ItemDef> itemDefs = new List<ItemDef> { wickedItem.Definition };
		contentPack.itemDefs.Add(itemDefs.ToArray());
		args.ReportProgress(1f);
		yield break;
	}

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

	public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
	{
		args.ReportProgress(1f);
		yield break;
	}
}
internal class wickedItem
{
	public GameObject ItemModel;

	public Sprite ItemIcon;

	public static ItemDef Definition { get; private set; }

	public wickedItem()
	{
		LoadAssets();
		Definition = BuildItemDefinition();
	}

	private void LoadAssets()
	{
		using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("WickedRingRevived.wickedringrevived");
		AssetBundle val = AssetBundle.LoadFromStream(stream);
		ItemIcon = val.LoadAsset<Sprite>("Assets/wickedring/texwickedringicon.png");
	}

	public ItemDef BuildItemDefinition()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
		((Object)val).name = "CooldownRing";
		val.deprecatedTier = (ItemTier)2;
		val.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)7 };
		val.pickupIconSprite = ItemIcon;
		return val;
	}

	public ItemDisplayRuleDict BuildDisplayRules()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_001c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: 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_00b0: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_0338: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0480: Unknown result type (might be due to invalid IL or missing references)
		//IL_0496: Unknown result type (might be due to invalid IL or missing references)
		//IL_049b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_050f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0514: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0534: Unknown result type (might be due to invalid IL or missing references)
		//IL_0535: Unknown result type (might be due to invalid IL or missing references)
		//IL_0550: Unknown result type (might be due to invalid IL or missing references)
		//IL_0559: Unknown result type (might be due to invalid IL or missing references)
		//IL_0588: Unknown result type (might be due to invalid IL or missing references)
		//IL_058d: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05be: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_061c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0621: Unknown result type (might be due to invalid IL or missing references)
		//IL_0637: Unknown result type (might be due to invalid IL or missing references)
		//IL_063c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0652: Unknown result type (might be due to invalid IL or missing references)
		//IL_0657: Unknown result type (might be due to invalid IL or missing references)
		//IL_065c: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		ItemDisplayRuleDict val = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		val.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(0.01159f, 0.14157f, -0.06636f),
				localAngles = new Vector3(300f, 180f, 180f),
				localScale = new Vector3(0.1f, 0.1f, 0.1f)
			}
		});
		val.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(0.01371f, 0.05648f, -0.09268f),
				localAngles = new Vector3(300f, 180f, 180f),
				localScale = new Vector3(0.075f, 0.075f, 0.075f)
			}
		});
		val.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "MainWheelL",
				localPos = new Vector3(-0.01748f, 1.08975f, -1.52357f),
				localAngles = new Vector3(300f, 0f, 0f),
				localScale = new Vector3(1f, 1f, 1f)
			}
		});
		val.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(-0.00026f, 0.20756f, -0.12849f),
				localAngles = new Vector3(310f, 180f, 180f),
				localScale = new Vector3(0.1f, 0.1f, 0.1f)
			}
		});
		val.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(-0.0118f, 0.09237f, -0.05244f),
				localAngles = new Vector3(15f, 180f, 180f),
				localScale = new Vector3(0.075f, 0.075f, 0.075f)
			}
		});
		val.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(-0.00364f, 0.07695f, -0.06853f),
				localAngles = new Vector3(340f, 180f, 180f),
				localScale = new Vector3(0.075f, 0.075f, 0.075f)
			}
		});
		val.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootFrontL",
				localPos = new Vector3(0.00159f, 0.024f, -0.00071f),
				localAngles = new Vector3(0f, 120f, 180f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(0.0136f, 0.0441f, -0.08881f),
				localAngles = new Vector3(1E-05f, 180f, 180f),
				localScale = new Vector3(0.1f, 0.1f, 0.1f)
			}
		});
		val.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(-0.1655f, 0.32189f, -1.2976f),
				localAngles = new Vector3(10f, 180f, 180f),
				localScale = new Vector3(0.5f, 0.5f, 0.5f)
			}
		});
		val.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(0.05678f, 0.12228f, -0.13881f),
				localAngles = new Vector3(345f, 150f, 180f),
				localScale = new Vector3(0.08f, 0.08f, 0.08f)
			}
		});
		val.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = ItemModel,
				childName = "FootL",
				localPos = new Vector3(0.02064f, 0.09363f, -0.11238f),
				localAngles = new Vector3(330f, 170f, 180f),
				localScale = new Vector3(0.1f, 0.1f, 0.1f)
			}
		});
		return val;
	}

	public void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
	{
		orig.Invoke(self);
		if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.master) && Object.op_Implicit((Object)(object)self.master.inventory))
		{
			if (false)
			{
				float num = (float)self.master.inventory.GetItemCount(Definition) * 5f;
				self.crit += num;
			}
			else if (self.master.inventory.GetItemCount(Definition) > 0)
			{
				self.crit += 5f;
			}
		}
	}

	public void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
	{
		orig.Invoke(self, damageInfo);
		if (!damageInfo.crit || damageInfo.rejected || !Object.op_Implicit((Object)(object)damageInfo.attacker))
		{
			return;
		}
		CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
		if (!Object.op_Implicit((Object)(object)component))
		{
			return;
		}
		CharacterMaster master = component.master;
		if (!Object.op_Implicit((Object)(object)master))
		{
			return;
		}
		int itemCount = master.inventory.GetItemCount(Definition);
		if (itemCount > 0)
		{
			float num = 1f * (float)itemCount;
			SkillLocator skillLocator = component.skillLocator;
			if (Object.op_Implicit((Object)(object)skillLocator))
			{
				skillLocator.DeductCooldownFromAllSkillsServer(num);
			}
			Util.PlaySound("Play_item_proc_crit_cooldown", damageInfo.attacker.gameObject);
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI" })]
[BepInPlugin("com.phreel.wickedringrevived", "WickedRingRevived", "1.0.5")]
public class WickedRingRevived : BaseUnityPlugin
{
	private const string ModVer = "1.0.5";

	private const string ModName = "WickedRingRevived";

	private const string ModGuid = "com.phreel.wickedringrevived";

	private wickedItem item;

	public void Awake()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		item = new wickedItem();
		new ContentPacks().Initialize();
		CharacterBody.RecalculateStats += new hook_RecalculateStats(item.CharacterBody_RecalculateStats);
		HealthComponent.TakeDamage += new hook_TakeDamage(item.HealthComponent_TakeDamage);
		ContentManager.onContentPacksAssigned += ContentManager_onContentPacksAssigned;
	}

	public void ContentManager_onContentPacksAssigned(ReadOnlyArray<ReadOnlyContentPack> obj)
	{
		ItemDef cooldownOnCrit = Items.CooldownOnCrit;
		wickedItem.Definition.nameToken = cooldownOnCrit.nameToken;
		wickedItem.Definition.descriptionToken = cooldownOnCrit.descriptionToken;
		wickedItem.Definition.pickupToken = cooldownOnCrit.pickupToken;
		wickedItem.Definition.pickupModelPrefab = cooldownOnCrit.pickupModelPrefab;
		wickedItem.Definition.loreToken = cooldownOnCrit.loreToken;
	}
}