Add files via upload

This commit is contained in:
janavarro95 2016-06-09 09:41:16 -07:00
parent 1c47eddb16
commit e2fe51f502
6 changed files with 108 additions and 24 deletions

View File

@ -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

View File

@ -49,8 +49,6 @@ namespace BuildEndurance
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
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.OneSecondTick += Tool_Cleanup;
@ -64,7 +62,7 @@ namespace BuildEndurance
var configLocation = Path.Combine(PathOnDisk, "BuildEnduranceConfig.json");
if (!File.Exists(configLocation))
{
Console.WriteLine("Initial configuration file setup.");
Log.Info("Initial configuration file setup.");
ModConfig = new Config();
ModConfig.BuildEndurance_current_lvl = 0;
@ -93,17 +91,14 @@ namespace BuildEndurance
else
{
ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation)));
Console.WriteLine("Found BuildEndurance config file.");
Log.Info("Found BuildEndurance config file.");
}
// DataLoader();
// 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.
{
if (tool_cleaner == true) return;
@ -168,15 +163,20 @@ namespace BuildEndurance
}
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.timeOfDay==2600)
if (StardewValley.Game1.farmerShouldPassOut == true)
{
BuildEndurance_data_xp_current += ModConfig.BuildEndurance_Pass_Out_XP;
collapse_check = true;
Log.Info("The player has collapsed!");
return;
}
}
}
@ -209,7 +209,7 @@ namespace BuildEndurance
if (BuildEndurance_data_clear_mod_effects == true)
{
player.MaxStamina = BuildEndurance_data_old_stamina;
Console.WriteLine("BuildEndurance Reset!");
// Console.WriteLine("BuildEndurance Reset!");
}
DataLoader();
@ -226,11 +226,11 @@ namespace BuildEndurance
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);
Clear_Checker();
Log.Info("CLEAR???");
//Log.Info("CLEAR???");
Log.Info(BuildEndurance_data_clear_mod_effects);
@ -263,7 +263,7 @@ namespace BuildEndurance
BuildEndurance_data_current_lvl = 0;
//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;
Log.Info("THIS IS MY NEW DAY CALL BACK XP version 2!");
Log.Info(BuildEndurance_data_xp_current);
Log.Info("IF YOU SEE THIS TOO MUCH THIS IS AN INFINITE LOOP. CRAP");
//Log.Info("THIS IS MY NEW DAY CALL BACK XP version 2!");
// Log.Info(BuildEndurance_data_xp_current);
// Log.Info("IF YOU SEE THIS TOO MUCH THIS IS AN INFINITE LOOP. CRAP");
}
/*

View File

@ -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}

View File

@ -31,10 +31,19 @@ namespace BuildHealth
public bool fed = false;
public int old_health;
public int new_health;
public Config ModConfig { get; set; }
public static bool upon_loading = false;
public bool collapse_check;
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
public override void Entry(params object[] objects)
{
@ -45,11 +54,14 @@ namespace BuildHealth
StardewModdingAPI.Events.GameEvents.OneSecondTick += Tool_Cleanup;
StardewModdingAPI.Events.GameEvents.UpdateTick += ToolCallBack;
StardewModdingAPI.Events.PlayerEvents.LoadedGame += LoadingCallBack;
StardewModdingAPI.Events.GameEvents.UpdateTick += Collapse_Callback;
StardewModdingAPI.Events.GameEvents.UpdateTick += damage_check;
var configLocation = Path.Combine(PathOnDisk, "BuildHealthConfig.json");
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.BuildHealth_current_lvl = 0;
@ -74,12 +86,12 @@ namespace BuildHealth
else
{
ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation)));
Console.WriteLine("Found BuildHealth config file.");
Log.Info("Found BuildHealth config file.");
}
// DataLoader();
// 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)
{
if(upon_loading ==true){
collapse_check = false;
if (upon_loading ==true){
Clear_Checker();
@ -179,6 +217,10 @@ namespace BuildHealth
MyWritter();
}
old_health = StardewValley.Game1.player.maxHealth;
}
@ -212,8 +254,27 @@ namespace BuildHealth
DataLoader();
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.
public class Config
{
@ -234,6 +295,8 @@ namespace BuildHealth
public int BuildHealth_Health_accumulated { get; set; }
public int BuildHealth_Pass_Out_XP { get; set; }
}

Binary file not shown.