Copy paste to banquet for fools
This commit is contained in:
50
Projects/BanquetForFools/BanquetForCyka/Class1.cs
Normal file
50
Projects/BanquetForFools/BanquetForCyka/Class1.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
|
||||
namespace BanquetForCyka {
|
||||
[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string PluginGuid = "BanquetForCyka";
|
||||
private const string PluginName = "BanquetForCyka";
|
||||
private const string PluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<bool> debug;
|
||||
public static ConfigEntry<bool> debugXp;
|
||||
|
||||
public static ConfigEntry<float> xpMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
debug = Config.Bind("Debug", "Global Debug", false);
|
||||
debugXp = Config.Bind("Debug", "XP Debug", false);
|
||||
|
||||
xpMultiplier =
|
||||
Config.Bind("General", "XP Multiplier", 1f,
|
||||
new ConfigDescription("XP Multiplier", new AcceptableValueRange<float>(0.01f, 1024f)));
|
||||
|
||||
Logger.LogInfo("BanquetForCyka loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
Harmony harmony = new Harmony(PluginGuid);
|
||||
harmony.PatchAll();
|
||||
var originalMethods = harmony.GetPatchedMethods();
|
||||
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
|
||||
}
|
||||
|
||||
public static void LogDebug(string message, ConfigEntry<bool> debugFlag = null) {
|
||||
if (debug.Value || (debugFlag != null && debugFlag.Value))
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Stats), "AddXP")]
|
||||
public class Stats_AddXP {
|
||||
public static void Prefix(ref int amt) {
|
||||
Main.LogDebug("Original XP amount: " + amt, Main.debugXp);
|
||||
amt = (int)((float)amt * Main.xpMultiplier.Value);
|
||||
Main.LogDebug("Modified XP amount: " + amt, Main.debugXp);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user