Decompiled source of Infinite Flares Mod v0.4.0

PeakInfiniteFlares.dll

Decompiled 3 days ago
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 BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PeakInfinityFlare")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PeakInfinityFlare")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ffba66ac-3cf0-40b4-899d-f583a5de3891")]
[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 PeakInfiniteFlares;

[BepInPlugin("infinite.flares.mod", "Infinite Flares Mod", "0.4")]
public class InfiniteFlaresMod : BaseUnityPlugin
{
	public static KeyboardShortcut m_FlareKey = new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>());

	public static ConfigEntry<KeyboardShortcut> m_FlareKeyboardShortcut;

	internal static ManualLogSource m_Log { get; private set; }

	private void Awake()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		m_Log = ((BaseUnityPlugin)this).Logger;
		m_FlareKeyboardShortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>(new ConfigDefinition("KEY", "Flare Key"), m_FlareKey, (ConfigDescription)null);
		Harmony.CreateAndPatchAll(typeof(FlaresPatch), (string)null);
	}
}
public static class FlaresPatch
{
	[HarmonyPostfix]
	[HarmonyPatch(typeof(Character), "Awake")]
	public static void AwakePatch(Character __instance)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		FlareSpawner flareSpawner = ((Component)__instance).gameObject.AddComponent<FlareSpawner>();
		flareSpawner.m_KeyCode = ((KeyboardShortcut)(ref InfiniteFlaresMod.m_FlareKey)).MainKey;
		InfiniteFlaresMod.m_Log.LogInfo((object)("Added FlareSpawner to character: " + __instance.characterName));
	}
}
public class FlareSpawner : MonoBehaviour
{
	private bool m_IsLocal = false;

	private float m_Timer = 10f;

	private float m_Cooldown = 10f;

	public KeyCode m_KeyCode = (KeyCode)102;

	private void Awake()
	{
		m_IsLocal = ((Component)this).GetComponent<Character>().IsLocal;
	}

	private void Update()
	{
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		if (m_IsLocal)
		{
			m_Timer += Time.deltaTime;
			if (!(m_Timer < m_Cooldown) && Input.GetKeyDown((KeyCode)102))
			{
				m_Timer = 0f;
				((Component)this).GetComponent<PhotonView>().RPC("SpawnFlare_Rpc", (RpcTarget)2, new object[1] { ((Component)this).GetComponent<Character>().refs.backpackTransform.position });
			}
		}
	}

	[PunRPC]
	private void SpawnFlare_Rpc(Vector3 spawnPosition)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		Item val = default(Item);
		ItemDatabase.TryGetItem((ushort)32, ref val);
		PhotonNetwork.InstantiateItemRoom(((Object)val).name, spawnPosition, Quaternion.identity).GetComponent<Item>();
	}
}