48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using System;
|
|
using System.Linq;
|
|
using BepInEx;
|
|
using BepInEx.Configuration;
|
|
using HarmonyLib;
|
|
using HarmonyLib.Tools;
|
|
using MGSC;
|
|
|
|
namespace Quasimorph {
|
|
[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
|
|
public class Main : BaseUnityPlugin {
|
|
private const string PluginGuid = "Quasicyka";
|
|
private const string PluginName = "Quasicyka";
|
|
private const string PluginVersion = "1.0.0";
|
|
|
|
public static ConfigEntry<bool> debug;
|
|
public static ConfigEntry<int> scrappingMultiplier;
|
|
public static ConfigEntry<float> xpMultiplier;
|
|
|
|
public void Awake() {
|
|
debug = Config.Bind("General", "Debug", false);
|
|
scrappingMultiplier =
|
|
Config.Bind("General", "Scrapping Multiplier", 1,
|
|
new ConfigDescription("Scrapping Multiplier", new AcceptableValueRange<int>(1, 10000)));
|
|
xpMultiplier =
|
|
Config.Bind("General", "XP Multiplier", 1f,
|
|
new ConfigDescription("XP Multiplier", new AcceptableValueRange<float>(0.01f, 100f)));
|
|
|
|
Logger.LogInfo("Quasicyka loaded");
|
|
HarmonyFileLog.Enabled = true;
|
|
Harmony harmony = new Harmony(PluginGuid);
|
|
harmony.PatchAll();
|
|
var originalMethods = harmony.GetPatchedMethods();
|
|
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
|
|
}
|
|
|
|
[HarmonyPatch(typeof(Perk), "AddExp")]
|
|
[HarmonyPrefix]
|
|
public static void AddExp(ref int val) {
|
|
if (debug.Value)
|
|
Console.WriteLine($"Before: {val}");
|
|
val = (int)((float)val * scrappingMultiplier.Value);
|
|
if (debug.Value)
|
|
Console.WriteLine($"After: {val}");
|
|
}
|
|
}
|
|
}
|