Add xp multiplier maybe

This commit is contained in:
2025-04-06 00:44:52 +02:00
parent e4a99d093a
commit 1d5855989b
2 changed files with 12 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using HarmonyLib.Tools;
using MGSC;
namespace Quasimorph {
[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
@@ -21,7 +22,7 @@ namespace Quasimorph {
Config.Bind("General", "Scrapping Multiplier", 1,
new ConfigDescription("Scrapping Multiplier", new AcceptableValueRange<int>(1, 10000)));
xpMultiplier =
Config.Bind("General", "XP Multiplier", 1,
Config.Bind("General", "XP Multiplier", 1f,
new ConfigDescription("XP Multiplier", new AcceptableValueRange<float>(0.01f, 100f)));
Logger.LogInfo("Quasicyka loaded");
@@ -31,5 +32,15 @@ namespace Quasimorph {
var originalMethods = harmony.GetPatchedMethods();
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
}
[HarmonyPatch(typeof(Perk), nameof(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}");
}
}
}