using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using CleanUpCompany.Patches;
using HarmonyLib;
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("CleanUpCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CleanUpCompany")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("84f56abf-0837-41be-b0a6-07cd0cbdb54e")]
[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 CleanUpCompany
{
[BepInPlugin("HamCheese.CleanUpCompany", "Clean Up Company", "1.0.0")]
public class CUPBase : BaseUnityPlugin
{
private const string modGUID = "HamCheese.CleanUpCompany";
private const string modName = "Clean Up Company";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("HamCheese.CleanUpCompany");
private static CUPBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("HamCheese.CleanUpCompany");
mls.LogInfo((object)"The CUC has been awaken ;)");
harmony.PatchAll(typeof(CUPBase));
harmony.PatchAll(typeof(EnemyAIPatch));
}
}
}
namespace CleanUpCompany.Patches
{
[HarmonyPatch(typeof(Terminal))]
[HarmonyPatch(typeof(EnemyAI))]
internal class EnemyAIPatch
{
private static Dictionary<GameObject, int> enemyKilledCounts = new Dictionary<GameObject, int>();
[HarmonyPatch(typeof(EnemyAI))]
[HarmonyPatch("KillEnemy")]
[HarmonyPostfix]
private static void EnemyKilledCheck(EnemyAI __instance)
{
string text = "Default Title";
string text2 = "Default Body";
GameObject gameObject = ((Component)__instance).gameObject;
if (!enemyKilledCounts.ContainsKey(gameObject))
{
enemyKilledCounts[gameObject] = 0;
}
enemyKilledCounts[gameObject]++;
text = "ENEMY NEUTRALISED";
text2 = "Congratulations! The security of this location has been enhanced.\nTotal enemy Neutralised: " + enemyKilledCounts[gameObject];
HUDManager.Instance.DisplayTip(text, text2, false, false, "LC_Tip1");
}
[HarmonyPatch(typeof(Terminal), "RunTerminalEvents")]
[HarmonyPostfix]
private static void KillingMoneyPatch(ref int ___groupCredits)
{
int num = 0;
foreach (KeyValuePair<GameObject, int> enemyKilledCount in enemyKilledCounts)
{
int num2 = 100 * enemyKilledCount.Value;
num += num2;
}
___groupCredits += num;
enemyKilledCounts.Clear();
}
}
}