More cheap train
This commit is contained in:
@@ -14,6 +14,7 @@ namespace CykaRaider {
|
||||
public static ConfigEntry<int> lootTimeAdder;
|
||||
public static ConfigEntry<float> maxStackMultiplier;
|
||||
public static ConfigEntry<bool> autoLoot;
|
||||
public static ConfigEntry<float> upgradePriceMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> debugMode;
|
||||
|
||||
@@ -22,6 +23,7 @@ namespace CykaRaider {
|
||||
lootTimeAdder = Config.Bind("General", "Loot Time Adder", 0, new ConfigDescription("Loot Time Adder"));
|
||||
maxStackMultiplier = Config.Bind("General", "Max Stack Multiplier", 1f, new ConfigDescription("Max Stack Multiplier"));
|
||||
autoLoot = Config.Bind("General", "Auto Loot", false, new ConfigDescription("Auto Loot"));
|
||||
upgradePriceMultiplier = Config.Bind("General", "Upgrade Price Multiplier", 1f, new ConfigDescription("Upgrade Price Multiplier"));
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace CykaRaider
|
||||
@@ -52,6 +54,44 @@ namespace CykaRaider
|
||||
Console.WriteLine("CykaRaider: autoLoot: Bag closed");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(NPCControl), "UpgradeSkill")]
|
||||
public static class upgradePriceMultiplier {
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaRaider: upgradePriceMultiplier: Transpiler");
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (int i = 0; i < codes.Count; i++) {
|
||||
if (codes[i].opcode == OpCodes.Ldc_I4 && ((int)codes[i].operand == 125000 || (int)codes[i].operand == -125000)) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaRaider: upgradePriceMultiplier: Old price {0}", codes[i].operand);
|
||||
codes[i].operand = (int)((float)codes[i].operand * Main.upgradePriceMultiplier.Value);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaRaider: upgradePriceMultiplier: New price {0}", codes[i].operand);
|
||||
}
|
||||
}
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(NPCControl), "RefreshSkill")]
|
||||
public static class refreshSkillPriceMultiplier {
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaRaider: refreshSkillPriceMultiplier: Transpiler");
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (int i = 0; i < codes.Count; i++) {
|
||||
if (codes[i].opcode == OpCodes.Ldc_I4 && ((int)codes[i].operand == 125000 || (int)codes[i].operand == -125000)) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaRaider: refreshSkillPriceMultiplier: Old price {0}", codes[i].operand);
|
||||
codes[i].operand = (int)((float)codes[i].operand * Main.upgradePriceMultiplier.Value);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("CykaRaider: refreshSkillPriceMultiplier: New price {0}", codes[i].operand);
|
||||
}
|
||||
}
|
||||
return codes;
|
||||
}
|
||||
}
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(XRL.World.Parts.Experience), "HandleEvent")]
|
||||
// static void xpMultiplier(ref AwardedXPEvent E) {
|
||||
|
Reference in New Issue
Block a user