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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LC_MoneyForKills.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: AssemblyTitle("LC_MoneyForKills")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_MoneyForKills")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e4d3ad7d-1c27-4e0d-9735-5f6cb4c57f28")]
[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")]
public class Config
{
public static ConfigEntry<int> cVal1;
public static ConfigEntry<int> cVal2;
public static ConfigEntry<int> cVal3;
public static ConfigEntry<int> cVal4;
public static ConfigEntry<int> cVal5;
public static ConfigEntry<int> cVal6;
public static ConfigEntry<int> cVal7;
public static ConfigEntry<int> cVal8;
public static ConfigEntry<int> cVal9;
public static ConfigEntry<int> cVal10;
public static ConfigEntry<int> cVal11;
public static ConfigEntry<int> cVal12;
public static ConfigEntry<int> cVal13;
public static ConfigEntry<int> cVal14;
public static ConfigEntry<int> cValMod1;
public static ConfigEntry<int> cValMod2;
public static ConfigEntry<int> cValMod3;
public static ConfigEntry<int> cValMod4;
public static ConfigEntry<bool> cNotification;
public static ConfigEntry<int> cVal15;
public Config(ConfigFile cfg)
{
cVal1 = cfg.Bind<int>("Values", "SnareFleaReward", 25, "Credit reward for killing Snare Flea");
cVal2 = cfg.Bind<int>("Values", "BunkerSpiderReward", 80, "Credit reward for killing Bunker Spider");
cVal3 = cfg.Bind<int>("Values", "HoardingBugReward", 25, "Credit reward for killing Hoarding Bug");
cVal4 = cfg.Bind<int>("Values", "BrackenReward", 150, "Credit reward for killing Bracken");
cVal5 = cfg.Bind<int>("Values", "ThumperReward", 125, "Credit reward for killing Thumper");
cVal6 = cfg.Bind<int>("Values", "NutcrackerReward", 100, "Credit reward for killing Nutcracker");
cVal7 = cfg.Bind<int>("Values", "MaskedReward", 75, "Credit reward for killing Masked");
cVal8 = cfg.Bind<int>("Values", "ButlerReward", 100, "Credit reward for killing Butler");
cVal9 = cfg.Bind<int>("Values", "EyelessDogReward", 125, "Credit reward for killing Eyeless Dog");
cVal10 = cfg.Bind<int>("Values", "ForestKeeperReward", 300, "Credit reward for killing Forest Keeper");
cVal11 = cfg.Bind<int>("Values", "BaboonHawkReward", 25, "Credit reward for killing Baboon Hawk");
cVal12 = cfg.Bind<int>("Values", "ManticoilReward", 10, "Credit reward for killing Manticoil");
cVal13 = cfg.Bind<int>("Values", "TulipSnakeReward", 15, "Credit reward for killing Tulip Snake");
cVal14 = cfg.Bind<int>("Values", "KidnapperFoxReward", 140, "Credit reward for killing Kidnapper Fox");
cVal15 = cfg.Bind<int>("Values", "ManeaterReward", 300, "Credit reward for killing Maneater");
cValMod1 = cfg.Bind<int>("Modded Values", "ModdedReward0", 10, "Credit reward for killing any modded monster whose power level is < 1");
cValMod2 = cfg.Bind<int>("Modded Values", "ModdedReward1", 25, "Credit reward for killing any modded monster whose power level is > 1 and < 2");
cValMod3 = cfg.Bind<int>("Modded Values", "ModdedReward2", 75, "Credit reward for killing any modded monster whose power level is > 2 and < 3");
cValMod4 = cfg.Bind<int>("Modded Values", "ModdedReward3", 150, "Credit reward for killing any modded monster whose power level is >= 3");
cNotification = cfg.Bind<bool>("General", "PlayNotification", true, "Toggles notifications for killing a monster and the credits received");
}
}
namespace LC_MoneyForKills
{
[BepInPlugin("Jack.MoneyForKills", "MoneyForKills", "1.3.2")]
public class MFKBase : BaseUnityPlugin
{
private const string modGUID = "Jack.MoneyForKills";
private const string modName = "MoneyForKills";
private const string modVersion = "1.3.2";
private readonly Harmony harmony = new Harmony("Jack.MoneyForKills");
private static MFKBase Instance;
internal ManualLogSource mls;
public static Config myConfig { get; internal set; }
private void Awake()
{
myConfig = new Config(((BaseUnityPlugin)this).Config);
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Jack.MoneyForKills");
mls.LogInfo((object)"Successfully loaded MoneyForKills ver. 1.3.2");
harmony.PatchAll(typeof(MFKBase));
harmony.PatchAll(typeof(MoneyPatch));
}
}
}
namespace LC_MoneyForKills.Patches
{
[HarmonyPatch]
internal class MoneyPatch
{
private static Dictionary<string, int> enemyBounties;
private static readonly List<string> VanillaList;
private static int getBounty(EnemyType obj)
{
if (obj.enemyName == "Centipede")
{
return enemyBounties["SnareFlea"];
}
if (obj.enemyName == "Bunker Spider")
{
return enemyBounties["BunkerSpider"];
}
if (obj.enemyName == "Hoarding bug")
{
return enemyBounties["HoardingBug"];
}
if (obj.enemyName == "Flowerman")
{
return enemyBounties["Bracken"];
}
if (obj.enemyName == "Crawler")
{
return enemyBounties["Thumper"];
}
if (obj.enemyName == "Nutcracker")
{
return enemyBounties["Nutcracker"];
}
if (obj.enemyName == "Masked")
{
return enemyBounties["Masked"];
}
if (obj.enemyName == "Butler")
{
return enemyBounties["Butler"];
}
if (obj.enemyName == "MouthDog")
{
return enemyBounties["EyelessDog"];
}
if (obj.enemyName == "ForestGiant")
{
return enemyBounties["ForestKeeper"];
}
if (obj.enemyName == "Baboon hawk")
{
return enemyBounties["BaboonHawk"];
}
if (obj.enemyName == "Manticoil")
{
return enemyBounties["Manticoil"];
}
if (obj.enemyName == "Tulip Snake")
{
return enemyBounties["TulipSnake"];
}
if (obj.enemyName == "BushWolf")
{
return enemyBounties["KidnapperFox"];
}
if (obj.enemyName == "Maneater")
{
return enemyBounties["Maneater"];
}
if (!VanillaList.Contains(obj.enemyName))
{
if (obj.PowerLevel < 1f)
{
return enemyBounties["PL0"];
}
if (obj.PowerLevel > 1f && obj.PowerLevel < 2f)
{
return enemyBounties["PL1"];
}
if (obj.PowerLevel > 2f && obj.PowerLevel < 3f)
{
return enemyBounties["PL2"];
}
if (obj.PowerLevel >= 3f)
{
return enemyBounties["PL3"];
}
}
return 0;
}
private static string getName(EnemyType obj)
{
if (obj.enemyName == "Centipede")
{
return "Centipede";
}
if (obj.enemyName == "Bunker Spider")
{
return "Bunker Spider";
}
if (obj.enemyName == "Hoarding bug")
{
return "Hoarding Bug";
}
if (obj.enemyName == "Flowerman")
{
return "Bracken";
}
if (obj.enemyName == "Crawler")
{
return "Thumper";
}
if (obj.enemyName == "Nutcracker")
{
return "Nutcracker";
}
if (obj.enemyName == "Masked")
{
return "Masked";
}
if (obj.enemyName == "Butler")
{
return "Butler";
}
if (obj.enemyName == "MouthDog")
{
return "Eyeless Dog";
}
if (obj.enemyName == "ForestGiant")
{
return "Forest Giant";
}
if (obj.enemyName == "Baboon hawk")
{
return "Baboon Hawk";
}
if (obj.enemyName == "Manticoil")
{
return "Manticoil";
}
if (obj.enemyName == "Tulip Snake")
{
return "Tulip Snake";
}
if (obj.enemyName == "BushWolf")
{
return "Kidnapper Fox";
}
if (obj.enemyName == "Maneater")
{
return "Maneater";
}
if (!VanillaList.Contains(obj.enemyName))
{
return "Modded Entity";
}
return "";
}
[HarmonyPatch(typeof(EnemyAI))]
[HarmonyPatch("KillEnemy")]
[HarmonyPostfix]
private static void KillEnemyPatch(EnemyAI __instance)
{
EnemyType enemyType = __instance.enemyType;
if (getBounty(enemyType) != 0)
{
if (Config.cNotification.Value)
{
HUDManager.Instance.DisplayTip(getName(enemyType) + " killed!", getBounty(enemyType) + " credits have been added to your balance and quota", false, false, "LC_Tip1");
}
Terminal obj = Object.FindObjectOfType<Terminal>();
obj.groupCredits += getBounty(enemyType);
TimeOfDay instance = TimeOfDay.Instance;
instance.quotaFulfilled += getBounty(enemyType);
TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
}
}
static MoneyPatch()
{
enemyBounties = new Dictionary<string, int>
{
{
"SnareFlea",
Config.cVal1.Value
},
{
"BunkerSpider",
Config.cVal2.Value
},
{
"HoardingBug",
Config.cVal3.Value
},
{
"Bracken",
Config.cVal4.Value
},
{
"Thumper",
Config.cVal5.Value
},
{
"Nutcracker",
Config.cVal6.Value
},
{
"Masked",
Config.cVal7.Value
},
{
"Butler",
Config.cVal8.Value
},
{
"EyelessDog",
Config.cVal9.Value
},
{
"ForestKeeper",
Config.cVal10.Value
},
{
"BaboonHawk",
Config.cVal11.Value
},
{
"Manticoil",
Config.cVal12.Value
},
{
"TulipSnake",
Config.cVal13.Value
},
{
"KidnapperFox",
Config.cVal14.Value
},
{
"Maneater",
Config.cVal15.Value
},
{
"PL0",
Config.cValMod1.Value
},
{
"PL1",
Config.cValMod2.Value
},
{
"PL2",
Config.cValMod3.Value
},
{
"PL3",
Config.cValMod4.Value
}
};
VanillaList = new List<string>
{
"Red Locust Bees", "Manticoil", "Docile Locust Bees", "MouthDog", "ForestGiant", "Earth Leviathan", "RadMech", "Bush Wolf", "Tulip Snake", "Baboon hawk",
"Centipede", "Bunker Spider", "Hoarding bug", "Flowerman", "Crawler", "Blob", "Girl", "Puffer", "Nutcracker", "Clay Surgeon",
"Spring", "Jester", "Lasso", "Masked", "Butler", "Maneater"
};
}
}
}