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 Microsoft.CodeAnalysis;
using On.RoR2;
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("CaptainBeaconCooldown")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c441a45bee2a40301abdbaa70f21fdb8c06cf100")]
[assembly: AssemblyProduct("CaptainBeaconCooldown")]
[assembly: AssemblyTitle("CaptainBeaconCooldown")]
[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 CaptainBeaconCooldown
{
[BepInPlugin("Phys09.CaptainBeaconCooldown", "CaptainBeaconCooldown", "1.0.2")]
public class CaptainBeaconCooldown : BaseUnityPlugin
{
public const string PluginGUID = "Phys09.CaptainBeaconCooldown";
public const string PluginAuthor = "Phys09";
public const string PluginName = "CaptainBeaconCooldown";
public const string PluginVersion = "1.0.2";
public const float DEFAULT_HEALING_BEACON_COOLDOWN = 60f;
public const float DEFAULT_SHOCKING_BEACON_COOLDOWN = 60f;
public const float DEFAULT_EQUIPMENT_BEACON_COOLDOWN = 90f;
public const float DEFAULT_HACKING_BEACON_COOLDOWN = 240f;
public float[] beaconCooldowns;
public string[] beaconNameTokens = new string[4] { "CAPTAIN_SUPPLY_HEAL_NAME", "CAPTAIN_SUPPLY_SHOCKING_NAME", "CAPTAIN_SUPPLY_EQUIPMENT_RESTOCK_NAME", "CAPTAIN_SUPPLY_HACKING_NAME" };
public float leftBeaconStopwatch = 0f;
public float rightBeaconStopwatch = 0f;
public float leftBeaconCooldown;
public float rightBeaconCooldown;
public bool enableDebugMode;
public static ConfigEntry<float> HealingBeaconCD { get; set; }
public static ConfigEntry<float> ShockingBeaconCD { get; set; }
public static ConfigEntry<float> EquipmentBeaconCD { get; set; }
public static ConfigEntry<float> HackingBeaconCD { get; set; }
public static ConfigEntry<bool> EnableDebug { get; set; }
private void OnRoR2SkillsCaptainSupplyDropSkillDefIsReady(orig_FixedUpdate orig, CaptainSupplyDropController self)
{
self.supplyDrop1Skill.maxStock = 1 + self.supplyDrop1Skill.bonusStockFromBody;
self.supplyDrop2Skill.maxStock = 1 + self.supplyDrop2Skill.bonusStockFromBody;
for (int i = 0; i < beaconNameTokens.Length; i++)
{
if (self.supplyDrop1Skill.skillNameToken == beaconNameTokens[i])
{
leftBeaconCooldown = beaconCooldowns[i];
}
if (self.supplyDrop2Skill.skillNameToken == beaconNameTokens[i])
{
rightBeaconCooldown = beaconCooldowns[i];
}
}
if (self.supplyDrop1Skill.stock < self.supplyDrop1Skill.maxStock)
{
leftBeaconStopwatch += Time.fixedDeltaTime;
}
if (self.supplyDrop2Skill.stock < 1)
{
rightBeaconStopwatch += Time.fixedDeltaTime;
}
if (self.supplyDrop2Skill.stock > 1)
{
self.supplyDrop2Skill.stock = 1;
}
if (leftBeaconStopwatch >= leftBeaconCooldown)
{
leftBeaconStopwatch = 0f;
GenericSkill supplyDrop1Skill = self.supplyDrop1Skill;
supplyDrop1Skill.stock += 1;
}
if (rightBeaconStopwatch >= rightBeaconCooldown)
{
rightBeaconStopwatch = 0f;
GenericSkill supplyDrop2Skill = self.supplyDrop2Skill;
supplyDrop2Skill.stock += 1;
Log.Info($"MaxStock of right beacon: {self.supplyDrop2Skill.maxStock}");
}
if (enableDebugMode && Input.GetKeyDown((KeyCode)108))
{
Log.Info("==================== Starting to print all values of supplydrop ====================");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.skillName'");
Log.Info(self.supplyDrop1Skill.skillName ?? "");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.bonusStockFromBody'");
Log.Info($"{self.supplyDrop1Skill.bonusStockFromBody}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.baseStock'");
Log.Info($"{self.supplyDrop1Skill.baseStock}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.finalRechargeInterval'");
Log.Info($"{self.supplyDrop1Skill.finalRechargeInterval}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill._cooldownScale'");
Log.Info($"{self.supplyDrop1Skill._cooldownScale}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill._flatCooldownReduction'");
Log.Info($"{self.supplyDrop1Skill._flatCooldownReduction}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.baseRechargeStopwatch'");
Log.Info($"{self.supplyDrop1Skill.baseRechargeStopwatch}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.skillDef'");
Log.Info($"{self.supplyDrop1Skill.skillDef}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.baseSkill'");
Log.Info($"{self.supplyDrop1Skill.baseSkill}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.skillNameToken'");
Log.Info(self.supplyDrop1Skill.skillNameToken ?? "");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.skillDescriptionToken'");
Log.Info(self.supplyDrop1Skill.skillDescriptionToken ?? "");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.baseRechargeInterval'");
Log.Info($"{self.supplyDrop1Skill.baseRechargeInterval}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.rechargeStock'");
Log.Info($"{self.supplyDrop1Skill.rechargeStock}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.beginSkillCooldownOnSkillEnd'");
Log.Info($"{self.supplyDrop1Skill.beginSkillCooldownOnSkillEnd}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.isCombatSkill'");
Log.Info($"{self.supplyDrop1Skill.isCombatSkill}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.mustKeyPress'");
Log.Info($"{self.supplyDrop1Skill.mustKeyPress}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.defaultSkillDef'");
Log.Info($"{self.supplyDrop1Skill.defaultSkillDef}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.maxStock'");
Log.Info($"{self.supplyDrop1Skill.maxStock}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.stock'");
Log.Info($"{self.supplyDrop1Skill.stock}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.cooldownScale'");
Log.Info($"{self.supplyDrop1Skill.cooldownScale}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.flatCooldownReduction'");
Log.Info($"{self.supplyDrop1Skill.flatCooldownReduction}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.rechargeStopwatch'");
Log.Info($"{self.supplyDrop1Skill.rechargeStopwatch}");
Log.Info("Printing variable named: 'self.supplyDrop1Skill.cooldownRemaining'");
Log.Info($"{self.supplyDrop1Skill.cooldownRemaining}");
Log.Info("====================");
}
orig.Invoke(self);
}
private void OnEnable()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
CaptainSupplyDropController.FixedUpdate += new hook_FixedUpdate(OnRoR2SkillsCaptainSupplyDropSkillDefIsReady);
}
private void OnDisable()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
CaptainSupplyDropController.FixedUpdate -= new hook_FixedUpdate(OnRoR2SkillsCaptainSupplyDropSkillDefIsReady);
}
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
HealingBeaconCD = ((BaseUnityPlugin)this).Config.Bind<float>("Beacon Cooldowns", "Healing Beacon Cooldown", 60f, "Captain's Healing Beacon Cooldown in seconds. Default: " + 60f);
ShockingBeaconCD = ((BaseUnityPlugin)this).Config.Bind<float>("Beacon Cooldowns", "Shocking Beacon Cooldown", 60f, "Captain's Shocking Beacon Cooldown in seconds. Default: " + 60f);
EquipmentBeaconCD = ((BaseUnityPlugin)this).Config.Bind<float>("Beacon Cooldowns", "Equipment Beacon Cooldown", 90f, "Captain's Equipment Beacon Cooldown in seconds. Default: " + 90f);
HackingBeaconCD = ((BaseUnityPlugin)this).Config.Bind<float>("Beacon Cooldowns", "Hacking Beacon Cooldown", 240f, "Captain's Hacking Beacon Cooldown in seconds. Default: " + 240f);
EnableDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable Debug", "Enable Debugging Keybind(s)", false, "Enable debug keybinds (Like L to print some values to console)");
beaconCooldowns = new float[4] { HealingBeaconCD.Value, ShockingBeaconCD.Value, EquipmentBeaconCD.Value, HackingBeaconCD.Value };
enableDebugMode = EnableDebug.Value;
}
private void Update()
{
}
}
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);
}
}
}