Decompiled source of Artifixer v1.0.1

Artifixer.dll

Decompiled 4 hours 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.Logging;
using EntityStates.Mage.Weapon;
using Microsoft.CodeAnalysis;
using On.EntityStates.Mage.Weapon;
using On.RoR2;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExamplePlugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("yourname.artificertweaks", "ArtificerTweaks", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ArtificerTweaks : BaseUnityPlugin
{
	private const float rangeMultiplier = 2.5f;

	private static readonly FieldInfo leftTransformField = typeof(Flamethrower).GetField("leftFlamethrowerTransform", BindingFlags.Instance | BindingFlags.NonPublic);

	private static readonly FieldInfo rightTransformField = typeof(Flamethrower).GetField("rightFlamethrowerTransform", BindingFlags.Instance | BindingFlags.NonPublic);

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		Flamethrower.OnEnter += new hook_OnEnter(Flamethrower_OnEnter);
		Flamethrower.FixedUpdate += new hook_FixedUpdate(Flamethrower_FixedUpdate);
		SurvivorCatalog.Init += new hook_Init(SurvivorCatalog_Init);
	}

	private void Flamethrower_OnEnter(orig_OnEnter orig, Flamethrower self)
	{
		self.maxDistance *= 2.5f;
		orig.Invoke(self);
	}

	private void Flamethrower_FixedUpdate(orig_FixedUpdate orig, Flamethrower self)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self);
		object? value = leftTransformField.GetValue(self);
		Transform val = (Transform)((value is Transform) ? value : null);
		object? value2 = rightTransformField.GetValue(self);
		Transform val2 = (Transform)((value2 is Transform) ? value2 : null);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.localScale = new Vector3(1f, 1f, 2.5f);
		}
		if (Object.op_Implicit((Object)(object)val2))
		{
			val2.localScale = new Vector3(1f, 1f, 2.5f);
		}
	}

	private void SurvivorCatalog_Init(orig_Init orig)
	{
		orig.Invoke();
		AllowSprintDuringArtificerSkills();
	}

	private void AllowSprintDuringArtificerSkills()
	{
		//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)
		SkillLocator component = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion().GetComponent<SkillLocator>();
		FixSkill(component.primary);
		FixSkill(component.secondary);
		FixSkill(component.utility);
		FixSkill(component.special);
	}

	private void FixSkill(GenericSkill skillSlot)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		Variant[] variants = skillSlot.skillFamily.variants;
		for (int i = 0; i < variants.Length; i++)
		{
			variants[i].skillDef.canceledFromSprinting = false;
		}
	}
}
namespace ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

		private static string Format(object data, string file, int line)
		{
			string fileName = Path.GetFileName(file);
			return $"[{fileName}:{line}] {data}";
		}

		internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogDebug((object)Format(data, file, line));
		}

		internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogError((object)Format(data, file, line));
		}

		internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogFatal((object)Format(data, file, line));
		}

		internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogInfo((object)Format(data, file, line));
		}

		internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogMessage((object)Format(data, file, line));
		}

		internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogWarning((object)Format(data, file, line));
		}
	}
}