Add files via upload
This commit is contained in:
parent
1c47eddb16
commit
e2fe51f502
|
@ -0,0 +1,20 @@
|
||||||
|
Player: Build Endurance Data. Modification can cause errors. Edit at your own risk.
|
||||||
|
====================================================================================
|
||||||
|
Player Current Level:
|
||||||
|
0
|
||||||
|
Player Current XP:
|
||||||
|
0
|
||||||
|
Xp to next Level:
|
||||||
|
20
|
||||||
|
Initial Stam Bonus:
|
||||||
|
0
|
||||||
|
Additional Stam Bonus:
|
||||||
|
0
|
||||||
|
=======================================================================================
|
||||||
|
RESET ALL MOD EFFECTS? This will effective start you back at square 1. Also good if you want to remove this mod.
|
||||||
|
False
|
||||||
|
OLD STAMINA AMOUNT: This is the initial value of the Player's Stamina before this mod took over.
|
||||||
|
0
|
||||||
|
Nightly Stamina Value: This is the value of the player's stamina that was saved when the player slept.
|
||||||
|
0
|
||||||
|
|
|
@ -49,8 +49,6 @@ namespace BuildEndurance
|
||||||
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
|
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
|
||||||
public override void Entry(params object[] objects)
|
public override void Entry(params object[] objects)
|
||||||
{
|
{
|
||||||
Log.Info("HEYO WORLD");
|
|
||||||
|
|
||||||
StardewModdingAPI.Events.GameEvents.UpdateTick += EatingCallBack; //sloppy again but it'll do.
|
StardewModdingAPI.Events.GameEvents.UpdateTick += EatingCallBack; //sloppy again but it'll do.
|
||||||
|
|
||||||
StardewModdingAPI.Events.GameEvents.OneSecondTick += Tool_Cleanup;
|
StardewModdingAPI.Events.GameEvents.OneSecondTick += Tool_Cleanup;
|
||||||
|
@ -64,7 +62,7 @@ namespace BuildEndurance
|
||||||
var configLocation = Path.Combine(PathOnDisk, "BuildEnduranceConfig.json");
|
var configLocation = Path.Combine(PathOnDisk, "BuildEnduranceConfig.json");
|
||||||
if (!File.Exists(configLocation))
|
if (!File.Exists(configLocation))
|
||||||
{
|
{
|
||||||
Console.WriteLine("Initial configuration file setup.");
|
Log.Info("Initial configuration file setup.");
|
||||||
ModConfig = new Config();
|
ModConfig = new Config();
|
||||||
|
|
||||||
ModConfig.BuildEndurance_current_lvl = 0;
|
ModConfig.BuildEndurance_current_lvl = 0;
|
||||||
|
@ -93,17 +91,14 @@ namespace BuildEndurance
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation)));
|
ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation)));
|
||||||
Console.WriteLine("Found BuildEndurance config file.");
|
Log.Info("Found BuildEndurance config file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataLoader();
|
// DataLoader();
|
||||||
// MyWritter(); //hopefully loading these after the game is loaded will prevent wierd issues.
|
// MyWritter(); //hopefully loading these after the game is loaded will prevent wierd issues.
|
||||||
|
|
||||||
Console.WriteLine("BuildEndurance Initialization Completed");
|
Log.Info("BuildEndurance Initialization Completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void ToolCallBack(object sender, EventArgs e) //ultra quick response for checking if a tool is used.
|
public void ToolCallBack(object sender, EventArgs e) //ultra quick response for checking if a tool is used.
|
||||||
{
|
{
|
||||||
if (tool_cleaner == true) return;
|
if (tool_cleaner == true) return;
|
||||||
|
@ -127,7 +122,7 @@ namespace BuildEndurance
|
||||||
if (tool_cleaner == true) tool_cleaner = false;
|
if (tool_cleaner == true) tool_cleaner = false;
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EatingCallBack(object sender, EventArgs e)
|
public void EatingCallBack(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -164,19 +159,24 @@ namespace BuildEndurance
|
||||||
Log.Info("The player is exhausted");
|
Log.Info("The player is exhausted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void Collapse_Callback(object sender, EventArgs e) //if the player stays up too late add some xp.
|
public void Collapse_Callback(object sender, EventArgs e) //if the player stays up too late add some xp.
|
||||||
{
|
{
|
||||||
if (collapse_check == false)
|
if (collapse_check == false)
|
||||||
{
|
{
|
||||||
if (StardewValley.Game1.timeOfDay==2600)
|
|
||||||
|
if (StardewValley.Game1.farmerShouldPassOut == true)
|
||||||
{
|
{
|
||||||
|
|
||||||
BuildEndurance_data_xp_current += ModConfig.BuildEndurance_Pass_Out_XP;
|
BuildEndurance_data_xp_current += ModConfig.BuildEndurance_Pass_Out_XP;
|
||||||
collapse_check = true;
|
collapse_check = true;
|
||||||
Log.Info("The player has collapsed!");
|
Log.Info("The player has collapsed!");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ namespace BuildEndurance
|
||||||
if (BuildEndurance_data_clear_mod_effects == true)
|
if (BuildEndurance_data_clear_mod_effects == true)
|
||||||
{
|
{
|
||||||
player.MaxStamina = BuildEndurance_data_old_stamina;
|
player.MaxStamina = BuildEndurance_data_old_stamina;
|
||||||
Console.WriteLine("BuildEndurance Reset!");
|
// Console.WriteLine("BuildEndurance Reset!");
|
||||||
}
|
}
|
||||||
|
|
||||||
DataLoader();
|
DataLoader();
|
||||||
|
@ -226,11 +226,11 @@ namespace BuildEndurance
|
||||||
if (upon_loading == true)
|
if (upon_loading == true)
|
||||||
{
|
{
|
||||||
|
|
||||||
Log.Info("THIS IS MY NEW DAY CALL BACK XP version 1");
|
//Log.Info("THIS IS MY NEW DAY CALL BACK XP version 1");
|
||||||
Log.Info(BuildEndurance_data_xp_current);
|
Log.Info(BuildEndurance_data_xp_current);
|
||||||
|
|
||||||
Clear_Checker();
|
Clear_Checker();
|
||||||
Log.Info("CLEAR???");
|
//Log.Info("CLEAR???");
|
||||||
Log.Info(BuildEndurance_data_clear_mod_effects);
|
Log.Info(BuildEndurance_data_clear_mod_effects);
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ namespace BuildEndurance
|
||||||
BuildEndurance_data_current_lvl = 0;
|
BuildEndurance_data_current_lvl = 0;
|
||||||
|
|
||||||
//because this doesn't work propperly at first anyways.
|
//because this doesn't work propperly at first anyways.
|
||||||
Console.WriteLine("BuildEndurance Reset!");
|
// Console.WriteLine("BuildEndurance Reset!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,9 +280,9 @@ namespace BuildEndurance
|
||||||
BuildEndurance_data_stam_bonus_acumulated += ModConfig.BuildEndurance_stam_increase_upon_lvl_up;
|
BuildEndurance_data_stam_bonus_acumulated += ModConfig.BuildEndurance_stam_increase_upon_lvl_up;
|
||||||
|
|
||||||
|
|
||||||
Log.Info("THIS IS MY NEW DAY CALL BACK XP version 2!");
|
//Log.Info("THIS IS MY NEW DAY CALL BACK XP version 2!");
|
||||||
Log.Info(BuildEndurance_data_xp_current);
|
// Log.Info(BuildEndurance_data_xp_current);
|
||||||
Log.Info("IF YOU SEE THIS TOO MUCH THIS IS AN INFINITE LOOP. CRAP");
|
// Log.Info("IF YOU SEE THIS TOO MUCH THIS IS AN INFINITE LOOP. CRAP");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
{"BuildHealth_xp_nextlvl":20.0,"BuildHealth_xp_current":0.0,"BuildHealth_xp_curve":1.15,"BuildHealth_current_lvl":0,"BuildHealth_max_lvl":100,"BuildHealth_Health_increase_upon_lvl_up":1,"BuildHealth_xp_tooluse":1,"BuildHealth_xp_eating":2,"BuildHealth_xp_sleeping":10,"BuildHealth_ini_Health_boost":0,"BuildHealth_Health_accumulated":0}
|
|
@ -31,10 +31,19 @@ namespace BuildHealth
|
||||||
|
|
||||||
public bool fed = false;
|
public bool fed = false;
|
||||||
|
|
||||||
|
|
||||||
|
public int old_health;
|
||||||
|
|
||||||
|
public int new_health;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Config ModConfig { get; set; }
|
public Config ModConfig { get; set; }
|
||||||
|
|
||||||
public static bool upon_loading = false;
|
public static bool upon_loading = false;
|
||||||
|
|
||||||
|
public bool collapse_check;
|
||||||
|
|
||||||
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
|
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
|
||||||
public override void Entry(params object[] objects)
|
public override void Entry(params object[] objects)
|
||||||
{
|
{
|
||||||
|
@ -45,11 +54,14 @@ namespace BuildHealth
|
||||||
StardewModdingAPI.Events.GameEvents.OneSecondTick += Tool_Cleanup;
|
StardewModdingAPI.Events.GameEvents.OneSecondTick += Tool_Cleanup;
|
||||||
StardewModdingAPI.Events.GameEvents.UpdateTick += ToolCallBack;
|
StardewModdingAPI.Events.GameEvents.UpdateTick += ToolCallBack;
|
||||||
StardewModdingAPI.Events.PlayerEvents.LoadedGame += LoadingCallBack;
|
StardewModdingAPI.Events.PlayerEvents.LoadedGame += LoadingCallBack;
|
||||||
|
StardewModdingAPI.Events.GameEvents.UpdateTick += Collapse_Callback;
|
||||||
|
|
||||||
|
StardewModdingAPI.Events.GameEvents.UpdateTick += damage_check;
|
||||||
|
|
||||||
var configLocation = Path.Combine(PathOnDisk, "BuildHealthConfig.json");
|
var configLocation = Path.Combine(PathOnDisk, "BuildHealthConfig.json");
|
||||||
if (!File.Exists(configLocation))
|
if (!File.Exists(configLocation))
|
||||||
{
|
{
|
||||||
Console.WriteLine("The config file for BuildHealth was not found, guess I'll create it...");
|
Log.Info("The config file for BuildHealth was not found, guess I'll create it...");
|
||||||
ModConfig = new Config();
|
ModConfig = new Config();
|
||||||
|
|
||||||
ModConfig.BuildHealth_current_lvl = 0;
|
ModConfig.BuildHealth_current_lvl = 0;
|
||||||
|
@ -74,12 +86,12 @@ namespace BuildHealth
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation)));
|
ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation)));
|
||||||
Console.WriteLine("Found BuildHealth config file.");
|
Log.Info("Found BuildHealth config file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataLoader();
|
// DataLoader();
|
||||||
// MyWritter();
|
// MyWritter();
|
||||||
Console.WriteLine("BuildHealth Initialization Completed");
|
Log.Info("BuildHealth Initialization Completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,9 +141,35 @@ namespace BuildHealth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void damage_check(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var player = StardewValley.Game1.player;
|
||||||
|
|
||||||
|
if (old_health > player.health)
|
||||||
|
{
|
||||||
|
BuildHealth_data_xp_current += (old_health - player.health);
|
||||||
|
//Log.Info(old_health - player.health);
|
||||||
|
old_health = (player.health);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (old_health < player.health)
|
||||||
|
{
|
||||||
|
old_health = player.health;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void SleepCallback(object sender, EventArgs e)
|
public void SleepCallback(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(upon_loading ==true){
|
collapse_check = false;
|
||||||
|
if (upon_loading ==true){
|
||||||
|
|
||||||
Clear_Checker();
|
Clear_Checker();
|
||||||
|
|
||||||
|
@ -179,7 +217,11 @@ namespace BuildHealth
|
||||||
|
|
||||||
MyWritter();
|
MyWritter();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
old_health = StardewValley.Game1.player.maxHealth;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void LoadingCallBack(object sender, EventArgs e)
|
public void LoadingCallBack(object sender, EventArgs e)
|
||||||
|
@ -212,8 +254,27 @@ namespace BuildHealth
|
||||||
DataLoader();
|
DataLoader();
|
||||||
MyWritter();
|
MyWritter();
|
||||||
}
|
}
|
||||||
|
old_health = StardewValley.Game1.player.maxHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Collapse_Callback(object sender, EventArgs e) //if the player stays up too late add some xp.
|
||||||
|
{
|
||||||
|
if (collapse_check == false)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (StardewValley.Game1.farmerShouldPassOut == true)
|
||||||
|
{
|
||||||
|
|
||||||
|
BuildHealth_data_xp_current += ModConfig.BuildHealth_Pass_Out_XP;
|
||||||
|
collapse_check = true;
|
||||||
|
Log.Info("The player has collapsed!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Mod config data.
|
//Mod config data.
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
|
@ -234,6 +295,8 @@ namespace BuildHealth
|
||||||
|
|
||||||
public int BuildHealth_Health_accumulated { get; set; }
|
public int BuildHealth_Health_accumulated { get; set; }
|
||||||
|
|
||||||
|
public int BuildHealth_Pass_Out_XP { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue