using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ultrakill Dual Wield Skill Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ultrakill Dual Wield Skill Mod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("118d6cb8-6e15-4c1e-8f93-e0833b89ea40")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DualWieldSkill;
[BepInPlugin("com.ReFraX.ultrakill.dualwieldskill", "Dual Wield Skill", "1.0.0")]
public class DualWieldMod : BaseUnityPlugin
{
private ConfigEntry<float> cooldownConfig;
private ConfigEntry<string> inputKeyConfig;
private ConfigEntry<float> powerUpDurationConfig;
private float nextUseTime = 0f;
private Text cooldownText;
private KeyCode inputKey;
private void Awake()
{
//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)
cooldownConfig = ((BaseUnityPlugin)this).Config.Bind<float>("", "Cooldown Time", 100f, "Cooldown time in seconds for the dual-wield power-up.");
inputKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("", "Activate Dual-Wield", "B", "Key to activate the dual-wield skill.");
powerUpDurationConfig = ((BaseUnityPlugin)this).Config.Bind<float>("", "Power-Up Duration", 30f, "Duration in seconds for the dual-wield power-up.");
inputKey = ParseKeyCode(inputKeyConfig.Value);
}
private void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("CooldownText");
val.transform.SetParent(GameObject.Find("Canvas").transform);
CanvasGroup val2 = val.AddComponent<CanvasGroup>();
val2.interactable = false;
val2.blocksRaycasts = false;
cooldownText = val.AddComponent<Text>();
cooldownText.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
cooldownText.fontSize = 24;
((Graphic)cooldownText).color = Color.white;
cooldownText.alignment = (TextAnchor)0;
RectTransform component = ((Component)cooldownText).GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 1f);
component.anchorMax = new Vector2(0f, 1f);
component.pivot = new Vector2(0f, 1f);
component.anchoredPosition = new Vector2(10f, -10f);
}
private void Update()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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)
if (((object)(KeyCode)(ref inputKey)).ToString() != inputKeyConfig.Value.ToUpper())
{
inputKey = ParseKeyCode(inputKeyConfig.Value);
}
if (Input.GetKeyDown(inputKey) && Time.time >= nextUseTime)
{
ActivateDualWield();
nextUseTime = Time.time + cooldownConfig.Value;
}
float num = Mathf.Max(0f, nextUseTime - Time.time);
if (num > 0f)
{
cooldownText.text = $"Dual Wield: {num:F1}s";
}
else
{
cooldownText.text = "Dual Wield: Ready!";
}
}
private void ActivateDualWield()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_003a: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)MonoSingleton<GunControl>.Instance))
{
GameObject val = new GameObject();
val.transform.SetParent(((Component)MonoSingleton<GunControl>.Instance).transform, true);
val.transform.localRotation = Quaternion.identity;
DualWield[] componentsInChildren = ((Component)MonoSingleton<GunControl>.Instance).GetComponentsInChildren<DualWield>();
if (componentsInChildren != null && componentsInChildren.Length % 2 == 0)
{
val.transform.localScale = new Vector3(-1f, 1f, 1f);
}
else
{
val.transform.localScale = Vector3.one;
}
if (componentsInChildren == null || componentsInChildren.Length == 0)
{
val.transform.localPosition = Vector3.zero;
}
else if (componentsInChildren.Length % 2 == 0)
{
val.transform.localPosition = new Vector3((float)(componentsInChildren.Length / 2) * -1.5f, 0f, 0f);
}
else
{
val.transform.localPosition = new Vector3((float)((componentsInChildren.Length + 1) / 2) * 1.5f, 0f, 0f);
}
DualWield val2 = val.AddComponent<DualWield>();
val2.delay = 0.05f;
val2.juiceAmount = powerUpDurationConfig.Value;
if (componentsInChildren != null && componentsInChildren.Length != 0)
{
val2.delay += (float)componentsInChildren.Length / 20f;
}
}
}
private KeyCode ParseKeyCode(string key)
{
//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_001e: Unknown result type (might be due to invalid IL or missing references)
return (KeyCode)Enum.Parse(typeof(KeyCode), key.ToUpper());
}
}