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 HarmonyLib;
using LethalCrew.Patches;
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 = "")]
[assembly: AssemblyCompany("LethalCrew")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Lethal Crew Desc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCrew")]
[assembly: AssemblyTitle("LethalCrew")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LethalCrew
{
[BepInPlugin("LethalCrew", "LethalCrew", "1.0.0")]
public class LethalCrew : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("LethalCrew");
public static ConfigEntry<bool> configRewardCredits;
public static ConfigEntry<bool> configRewardQuota;
public static ConfigEntry<int> configCentipedeReward;
public static ConfigEntry<int> configSpiderReward;
public static ConfigEntry<int> configHoarderBugReward;
public static ConfigEntry<int> configFlowerManReward;
public static ConfigEntry<int> configCrawlerReward;
public static ConfigEntry<int> configNutcrackerReward;
public static ConfigEntry<int> configMaskedPlayerReward;
public static ConfigEntry<int> configDogReward;
public static ConfigEntry<int> configBaboonReward;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalCrew is loaded!");
configRewardCredits = ((BaseUnityPlugin)this).Config.Bind<bool>("__General__", "DoRewardsGrantCredits", true, "Does killing an enemy grants credits ?");
configRewardQuota = ((BaseUnityPlugin)this).Config.Bind<bool>("__General__", "DoRewardsGrantQuota", true, "Does killing an enemy grants quota ?");
configCentipedeReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "CentipedeReward", 15, "How much does a Centipede/Snare flea grants upon death.");
configSpiderReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "SpiderReward", 45, "How much does a Spider grants upon death.");
configHoarderBugReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "HoarderBugReward", 25, "How much does a Hoarder bug grants upon death.");
configFlowerManReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "FlowerManReward", 150, "How much does a Flower Man/Bracken grants upon death.");
configCrawlerReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "CrawlerReward", 75, "How much does a Crawler/Thumper grants upon death.");
configNutcrackerReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "NutcrackerReward", 250, "How much does a Nutcracker grants upon death.");
configMaskedPlayerReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "MaskedPlayerReward", 35, "How much does a MaskedPlayer/Zombie grants upon death.");
configDogReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "DogReward", 300, "How much does a Dog grants upon death.");
configBaboonReward = ((BaseUnityPlugin)this).Config.Bind<int>("__Rewards__", "BaboonHawkReward", 50, "How much does Baboon Hawk grants upon death.");
harmony.PatchAll(typeof(LethalCrewPatch));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LethalCrew";
public const string PLUGIN_NAME = "LethalCrew";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LethalCrew.Patches
{
[HarmonyPatch]
internal class LethalCrewPatch
{
private static void RewardEnemyKill(int _rewardValue, string _enemyName)
{
if (_rewardValue > 0 && (LethalCrew.configRewardCredits.Value || LethalCrew.configRewardQuota.Value))
{
if (LethalCrew.configRewardCredits.Value)
{
Terminal val = Object.FindObjectOfType<Terminal>();
val.groupCredits += _rewardValue;
}
if (LethalCrew.configRewardQuota.Value)
{
TimeOfDay instance = TimeOfDay.Instance;
instance.quotaFulfilled += _rewardValue;
TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
}
HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.reachedQuotaSFX);
HUDManager.Instance.DisplayTip("Congratulations !", "You killed " + _enemyName + " ! The Company granted you " + _rewardValue + " credits !", false, false, "LC_Tip1");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CentipedeAI), "KillEnemy")]
private static void KillCentipedePatch()
{
RewardEnemyKill(LethalCrew.configCentipedeReward.Value, "a Snare flea");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SandSpiderAI), "KillEnemy")]
private static void KillSpiderPatch()
{
RewardEnemyKill(LethalCrew.configSpiderReward.Value, "a Spider");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(HoarderBugAI), "KillEnemy")]
private static void KillHoarderBugPatch()
{
RewardEnemyKill(LethalCrew.configHoarderBugReward.Value, "a Hoarding Bug");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(FlowermanAI), "KillEnemy")]
private static void KillFlowerManPatch()
{
RewardEnemyKill(LethalCrew.configFlowerManReward.Value, "a Bracken");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CrawlerAI), "KillEnemy")]
private static void KillCrawlerPatch()
{
RewardEnemyKill(LethalCrew.configCrawlerReward.Value, "a Thumper");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(NutcrackerEnemyAI), "KillEnemy")]
private static void KillNutcrackerPatch()
{
RewardEnemyKill(LethalCrew.configNutcrackerReward.Value, "a Nutcracker");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MaskedPlayerEnemy), "KillEnemy")]
private static void KillMaskedPlayerPatch()
{
RewardEnemyKill(LethalCrew.configMaskedPlayerReward.Value, "a FRIEND");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MouthDogAI), "KillEnemy")]
private static void KillDogPatch()
{
RewardEnemyKill(LethalCrew.configDogReward.Value, "an Eyeless Dog");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(BaboonBirdAI), "KillEnemy")]
private static void KillBaboonBirdPatch()
{
RewardEnemyKill(LethalCrew.configBaboonReward.Value, "a Baboon hawk");
}
}
}