using System;
using System.Diagnostics;
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 CG.Client.Quests.SectorTwists;
using CG.Game.Player;
using CG.Ship.Modules;
using Gameplay.CompositeWeapons;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RetriggerGunFromSeat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RetriggerGunFromSeat")]
[assembly: AssemblyTitle("RetriggerGunFromSeat")]
[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 RetriggerGunFromSeat
{
internal class Configs
{
internal static ConfigEntry<KeyCode> retriggerKey;
internal static ConfigEntry<KeyCode> switchGunOnKey;
internal static ConfigEntry<KeyCode> switchGunOffKey;
internal static void Load(Plugin plugin)
{
retriggerKey = ((BaseUnityPlugin)plugin).Config.Bind<KeyCode>("RetriggerGunFromSeat", "retriggerGunKey", (KeyCode)0, (ConfigDescription)null);
switchGunOffKey = ((BaseUnityPlugin)plugin).Config.Bind<KeyCode>("RetriggerGunFromSeat", "retriggerGunOffKey", (KeyCode)0, (ConfigDescription)null);
switchGunOnKey = ((BaseUnityPlugin)plugin).Config.Bind<KeyCode>("RetriggerGunFromSeat", "retriggerGunOnKey", (KeyCode)0, (ConfigDescription)null);
}
}
internal class GUI : ModSettingsMenu
{
public override string Name()
{
return "RetriggerGunFromSeat";
}
public override void Draw()
{
//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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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)
GUILayout.Label("Retrigger Gun From Seat Settings:", Array.Empty<GUILayoutOption>());
KeyCode value = Configs.retriggerKey.Value;
if (GUITools.DrawChangeKeybindButton("Retrigger On/Off: ", ref value) && Configs.retriggerKey.Value != value)
{
Configs.retriggerKey.Value = value;
}
KeyCode value2 = Configs.switchGunOnKey.Value;
if (GUITools.DrawChangeKeybindButton("Trigger Gun On: ", ref value2) && Configs.switchGunOnKey.Value != value2)
{
Configs.switchGunOnKey.Value = value2;
}
KeyCode value3 = Configs.switchGunOffKey.Value;
if (GUITools.DrawChangeKeybindButton("Trigger Gun Off: ", ref value3) && Configs.switchGunOffKey.Value != value3)
{
Configs.switchGunOffKey.Value = value3;
}
}
}
[BepInPlugin("Gruncle.RetriggerGunFromSeat", "RetriggerGunFromSeat", "1.1.0")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Gruncle.RetriggerGunFromSeat";
public const string PLUGIN_NAME = "RetriggerGunFromSeat";
public const string PLUGIN_VERSION = "1.1.0";
}
internal static ManualLogSource log;
private void Awake()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
Configs.Load(this);
log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Gruncle.RetriggerGunFromSeat is loaded!");
}
}
[HarmonyPatch(typeof(CompositeWeaponModule))]
internal class RetriggerPlugin
{
internal static CompositeWeaponModule playerChair;
internal static bool weaponIsOccupied;
internal static bool malfunctionActive;
[HarmonyPostfix]
[HarmonyPatch("PlayerTakeoverLocal")]
private static void PlayerTakesChair(CompositeWeaponModule __instance)
{
playerChair = __instance;
weaponIsOccupied = true;
}
[HarmonyPrefix]
[HarmonyPatch("PlayerFreeLocal")]
private static void PlayerLeavesChair(CompositeWeaponModule __instance)
{
weaponIsOccupied = false;
}
}
[HarmonyPatch(typeof(LocalPlayer))]
internal class RetriggerUpdate
{
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void Update()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (GameSessionManager.ActiveSector != (GameSessionSector)null)
{
flag = GameSessionManager.ActiveSector.Twists.Exists((SectorTwist thing) => ((object)thing).GetType() == typeof(Interference));
}
if (!RetriggerPlugin.weaponIsOccupied)
{
return;
}
if (ButtonPressed(Configs.retriggerKey.Value))
{
if (flag)
{
Messaging.Notification("Cannot Retrigger Gun while malfunction surge is active.", false);
}
else if (((CellModule)RetriggerPlugin.playerChair).IsPowered)
{
((CellModule)RetriggerPlugin.playerChair).TurnOff();
}
else
{
((CellModule)RetriggerPlugin.playerChair).TurnOn();
}
}
else if (ButtonPressed(Configs.switchGunOnKey.Value) && !((CellModule)RetriggerPlugin.playerChair).IsPowered)
{
if (flag)
{
Messaging.Notification("Cannot Retrigger Gun while malfunction surge is active.", false);
}
else
{
((CellModule)RetriggerPlugin.playerChair).TurnOn();
}
}
else if (ButtonPressed(Configs.switchGunOffKey.Value) && ((CellModule)RetriggerPlugin.playerChair).IsPowered)
{
if (flag)
{
Messaging.Notification("Cannot Retrigger Gun while malfunction surge is active.", false);
}
else
{
((CellModule)RetriggerPlugin.playerChair).TurnOff();
}
}
}
public static bool ButtonPressed(KeyCode button)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
if ((int)button == 0)
{
return false;
}
return UnityInput.Current.GetKeyDown(button);
}
}
internal class VoidManagerPlugin : VoidPlugin
{
public override string Author => "Gruncle Chuck";
public override string Description => "Allows you to turn on/off the gun that you are sitting on.";
public override MultiplayerType MPType => (MultiplayerType)20;
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "RetriggerGunFromSeat";
public const string PLUGIN_NAME = "RetriggerGunFromSeat";
public const string PLUGIN_VERSION = "1.0.0";
}
}