Add options for level up stats and skills
This commit is contained in:
@@ -16,21 +16,35 @@ namespace BanquetForCyka {
|
|||||||
public static ConfigEntry<bool> debug;
|
public static ConfigEntry<bool> debug;
|
||||||
public static ConfigEntry<bool> debugXp;
|
public static ConfigEntry<bool> debugXp;
|
||||||
public static ConfigEntry<bool> debugDodgeWindow;
|
public static ConfigEntry<bool> debugDodgeWindow;
|
||||||
|
public static ConfigEntry<bool> debugStatEntry;
|
||||||
|
public static ConfigEntry<bool> debugSkillEntry;
|
||||||
|
public static ConfigEntry<bool> debugLevelUpEntry;
|
||||||
|
|
||||||
public static ExpressionConfigEntry xpMultiplier;
|
public static ExpressionConfigEntry xpMultiplier;
|
||||||
public static ExpressionConfigEntry dodgeWindow;
|
public static ExpressionConfigEntry dodgeWindow;
|
||||||
|
public static ExpressionConfigEntry levelUpStatEntry;
|
||||||
|
public static ExpressionConfigEntry levelUpSkillEntry;
|
||||||
|
|
||||||
public void Awake() {
|
public void Awake() {
|
||||||
debug = Config.Bind("Debug", "Global Debug", false);
|
debug = Config.Bind("Debug", "Global Debug", false);
|
||||||
debugXp = Config.Bind("Debug", "XP Debug", false);
|
debugXp = Config.Bind("Debug", "XP Debug", false);
|
||||||
debugDodgeWindow = Config.Bind("Debug", "Dodge Window Debug", false);
|
debugDodgeWindow = Config.Bind("Debug", "Dodge Window Debug", false);
|
||||||
|
debugStatEntry = Config.Bind("Debug", "Stat Entry Debug", false);
|
||||||
|
debugSkillEntry = Config.Bind("Debug", "Skill Entry Debug", false);
|
||||||
|
debugLevelUpEntry = Config.Bind("Debug", "Level Up Entry Debug", false);
|
||||||
|
|
||||||
xpMultiplier = new ExpressionConfigEntry(
|
xpMultiplier = new ExpressionConfigEntry(
|
||||||
Config, "General", "XP Multiplier", "v*1",
|
Config, "General", "XP Multiplier", "v*1",
|
||||||
"XP Multiplier expression. Use 'v' to represent the original value.", debugXp);
|
"XP Multiplier expression. Use 'v' to represent the original value.", debugXp);
|
||||||
dodgeWindow = new ExpressionConfigEntry(
|
dodgeWindow = new ExpressionConfigEntry(Config, "General", "Dodge Window", "v*1",
|
||||||
Config, "General", "Dodge Window", "v*1",
|
"Dodge Window expression. Use 'v' to represent the original value.",
|
||||||
"Dodge Window expression. Use 'v' to represent the original value.", debugDodgeWindow);
|
debugDodgeWindow);
|
||||||
|
levelUpStatEntry = new ExpressionConfigEntry(
|
||||||
|
Config, "General", "Level Up Stat Entry", "v*1",
|
||||||
|
"Stat Entry expression. Use 'v' to represent the original value.", debugStatEntry);
|
||||||
|
levelUpSkillEntry = new ExpressionConfigEntry(
|
||||||
|
Config, "General", "Level Up Skill Entry", "v*1",
|
||||||
|
"Skill Entry expression. Use 'v' to represent the original value.", debugSkillEntry);
|
||||||
|
|
||||||
Logger.LogInfo("BanquetForCyka loaded");
|
Logger.LogInfo("BanquetForCyka loaded");
|
||||||
HarmonyFileLog.Enabled = true;
|
HarmonyFileLog.Enabled = true;
|
||||||
@@ -65,4 +79,69 @@ namespace BanquetForCyka {
|
|||||||
Main.LogDebug("Modified dodge window: " + __result, Main.debugDodgeWindow);
|
Main.LogDebug("Modified dodge window: " + __result, Main.debugDodgeWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(LevelUp), "ClickedStat")]
|
||||||
|
public class Actions_ClickedStat {
|
||||||
|
private static float originalStr;
|
||||||
|
private static float originalAgi;
|
||||||
|
private static float originalDex;
|
||||||
|
private static float originalPag;
|
||||||
|
private static float originalSen;
|
||||||
|
|
||||||
|
public static void Prefix(ref LevelUp __instance) {
|
||||||
|
Main.LogDebug("Original Str: " + __instance.character.stats.strength, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Original Agi: " + __instance.character.stats.agility, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Original Dex: " + __instance.character.stats.dexterity, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Original Pag: " + __instance.character.stats.pagan, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Original Sen: " + __instance.character.stats.sensory, Main.debugStatEntry);
|
||||||
|
|
||||||
|
originalStr = __instance.character.stats.strength;
|
||||||
|
originalAgi = __instance.character.stats.agility;
|
||||||
|
originalDex = __instance.character.stats.dexterity;
|
||||||
|
originalPag = __instance.character.stats.pagan;
|
||||||
|
originalSen = __instance.character.stats.sensory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Postfix(ref LevelUp __instance) {
|
||||||
|
float deltaStr = __instance.character.stats.strength - originalStr;
|
||||||
|
float deltaAgi = __instance.character.stats.agility - originalAgi;
|
||||||
|
float deltaDex = __instance.character.stats.dexterity - originalDex;
|
||||||
|
float deltaPag = __instance.character.stats.pagan - originalPag;
|
||||||
|
float deltaSen = __instance.character.stats.sensory - originalSen;
|
||||||
|
|
||||||
|
Main.LogDebug("Delta Str: " + deltaStr, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Delta Agi: " + deltaAgi, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Delta Dex: " + deltaDex, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Delta Pag: " + deltaPag, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Delta Sen: " + deltaSen, Main.debugStatEntry);
|
||||||
|
|
||||||
|
float resultStr = Main.levelUpStatEntry.Evaluate(deltaStr);
|
||||||
|
float resultAgi = Main.levelUpStatEntry.Evaluate(deltaAgi);
|
||||||
|
float resultDex = Main.levelUpStatEntry.Evaluate(deltaDex);
|
||||||
|
float resultPag = Main.levelUpStatEntry.Evaluate(deltaPag);
|
||||||
|
float resultSen = Main.levelUpStatEntry.Evaluate(deltaSen);
|
||||||
|
|
||||||
|
Main.LogDebug("Result Str: " + resultStr, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Result Agi: " + resultAgi, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Result Dex: " + resultDex, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Result Pag: " + resultPag, Main.debugStatEntry);
|
||||||
|
Main.LogDebug("Result Sen: " + resultSen, Main.debugStatEntry);
|
||||||
|
|
||||||
|
__instance.character.stats.strength = resultStr;
|
||||||
|
__instance.character.stats.agility = resultAgi;
|
||||||
|
__instance.character.stats.dexterity = resultDex;
|
||||||
|
__instance.character.stats.pagan = resultPag;
|
||||||
|
__instance.character.stats.sensory = resultSen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(LevelUp), "IncreaseAmount")]
|
||||||
|
public class Actions_IncreaseAmount {
|
||||||
|
public static void Postfix(ref int __result) {
|
||||||
|
Main.LogDebug("Original amount: " + __result, Main.debugLevelUpEntry);
|
||||||
|
float result = Main.levelUpSkillEntry.Evaluate(__result);
|
||||||
|
__result = (int)result;
|
||||||
|
Main.LogDebug("Modified amount: " + __result, Main.debugLevelUpEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user