Decompiled source of Super Syringe v1.1.5

SuperSyringe.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SuperSyringe")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SuperSyringe")]
[assembly: AssemblyTitle("SuperSyringe")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SuperSyringe
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Cleb.SuperSyringe", "SuperSyringe", "1.1.4")]
	public class SuperSyringe : BaseUnityPlugin
	{
		public static PluginInfo PInfo;

		public static ConfigEntry<float> SyringeFloatEntry;

		private static AssetBundle SuperSyringeBundle;

		private static ItemDef SuperSyringeDef;

		private static ConfigFile SuperSyringeConfig { get; set; }

		public void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			PInfo = ((BaseUnityPlugin)this).Info;
			SuperSyringeConfig = new ConfigFile(Paths.ConfigPath + "\\com.Cleb.SuperSyringe.cfg", true);
			SyringeFloatEntry = SuperSyringeConfig.Bind<float>("General", "Change Attack Speed Percentage", 35f, "35 = 35% Attack Speed (Base Soldier Syringe is 15%)");
			string text = Path.Combine(Path.GetDirectoryName(PInfo.Location), "SuperSyringeBundle");
			SuperSyringeBundle = AssetBundle.LoadFromFile(text);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			RegisterSyringe();
			LangTokens();
		}

		private void RegisterSyringe()
		{
			//IL_005d: 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_00b3: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			SuperSyringeDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)SuperSyringeDef).name = "SUPER_SYRINGE";
			SuperSyringeDef.nameToken = "SUPER_SYRINGE_NAME";
			SuperSyringeDef.pickupToken = "SUPER_SYRINGE_PICKUP";
			SuperSyringeDef.descriptionToken = "SUPER_SYRINGE_DESC";
			SuperSyringeDef.loreToken = "SUPER_SYRINGE_LORE";
			SuperSyringeDef.deprecatedTier = (ItemTier)1;
			SuperSyringeDef.canRemove = true;
			SuperSyringeDef.pickupIconSprite = SuperSyringeBundle.LoadAsset<Sprite>("SuperSyringeIcon");
			SuperSyringeDef.pickupModelPrefab = SuperSyringeBundle.LoadAsset<GameObject>("SuperSyringeModel");
			ItemAPI.Add(new CustomItem(SuperSyringeDef, new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>())));
		}

		public void LangTokens()
		{
			LanguageAPI.Add("SUPER_SYRINGE_NAME", "Super Syringe");
			LanguageAPI.Add("SUPER_SYRINGE_PICKUP", "Increases attack speed by " + SyringeFloatEntry.Value + "% per stack.");
			LanguageAPI.Add("SUPER_SYRINGE_DESC", "Increases attack speed by " + SyringeFloatEntry.Value + "% per stack. ");
			LanguageAPI.Add("A mysterious syringe that was recently discovered. The fact that this wasn't seen before recently brings up the question, who made it?");
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (!((Object)(object)sender.inventory == (Object)null))
			{
				int itemCountEffective = sender.inventory.GetItemCountEffective(SuperSyringeDef);
				if (itemCountEffective > 0)
				{
					args.attackSpeedMultAdd += SyringeFloatEntry.Value / 100f * (float)itemCountEffective;
				}
			}
		}
	}
}