Added files via upload

This commit is contained in:
janavarro95 2016-04-10 22:39:16 -07:00
parent fc5e99bfe6
commit 3035c174fd
6 changed files with 120 additions and 48 deletions

View File

@ -15,26 +15,26 @@ namespace BuildEndurance
public class BuildEndurance : Mod
{
public static double BuildEndurance_data_xp_nextlvl=20;
public static double BuildEndurance_data_xp_current=0;
static double BuildEndurance_data_xp_nextlvl = 20;
static double BuildEndurance_data_xp_current = 0;
public static int BuildEndurance_data_current_lvl=0;
static int BuildEndurance_data_current_lvl = 0;
public static int BuildEndurance_data_stam_bonus_acumulated=0;
static int BuildEndurance_data_stam_bonus_acumulated = 0;
public static int BuildEndurance_data_ini_stam_bonus=0;
static int BuildEndurance_data_ini_stam_bonus = 0;
public static bool BuildEndurance_data_clear_mod_effects = false;
static bool BuildEndurance_data_clear_mod_effects = false;
public static int BuildEndurance_data_old_stamina = 0;
static int BuildEndurance_data_old_stamina = 0;
public static bool tool_cleaner = false;
static bool tool_cleaner = false;
public static bool fed = false;
static bool fed = false;
public Config ModConfig { get; set; }
public static bool upon_loading = false;
static bool upon_loading = false;
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed.
public override void Entry(params object[] objects)
@ -92,10 +92,13 @@ namespace BuildEndurance
if (tool_cleaner == true) return;
if (StardewModdingAPI.Entities.SPlayer.CurrentFarmer.usingTool == true)
if (StardewValley.Game1.player.usingTool == true)
{
//Console.WriteLine("Tool is being used");
// Console.WriteLine("Tool is being used");
BuildEndurance_data_xp_current += ModConfig.BuildEndurance_xp_tooluse;
//BuildEndurance_data_xp_current += 1000; For testing purposes
// Log.Info(BuildEndurance_data_xp_current);
tool_cleaner = true;
}
else return;
@ -122,7 +125,7 @@ namespace BuildEndurance
//I'm going to assume they ate the food.
if ((StardewValley.Game1.isEating == false) && fed == true)
{
// Console.WriteLine("NOM NOM NOM");
//Console.WriteLine("NOM NOM NOM22222222222");
BuildEndurance_data_xp_current += ModConfig.BuildEndurance_xp_eating;
fed = false;
}
@ -170,7 +173,15 @@ namespace BuildEndurance
if (upon_loading == true)
{
Clear_DataLoader();
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(BuildEndurance_data_clear_mod_effects);
//Clear_DataLoader();
//because this doesn't work propperly at first anyways.
//return;
@ -188,6 +199,7 @@ namespace BuildEndurance
if (BuildEndurance_data_clear_mod_effects == true)
{
Clear_DataLoader();
player.MaxStamina = BuildEndurance_data_old_stamina;
BuildEndurance_data_xp_nextlvl = ModConfig.BuildEndurance_xp_nextlvl;
BuildEndurance_data_xp_current = ModConfig.BuildEndurance_xp_current;
@ -195,6 +207,8 @@ namespace BuildEndurance
BuildEndurance_data_old_stamina = player.MaxStamina;
BuildEndurance_data_ini_stam_bonus = 0;
BuildEndurance_data_current_lvl = 0;
//because this doesn't work propperly at first anyways.
Console.WriteLine("BuildEndurance Reset!");
}
@ -210,6 +224,10 @@ namespace BuildEndurance
BuildEndurance_data_xp_nextlvl = (ModConfig.BuildEndurance_xp_curve * BuildEndurance_data_xp_nextlvl);
player.MaxStamina += 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(BuildEndurance_data_xp_current);
Log.Info("IF YOU SEE THIS TOO MUCH THIS IS AN INFINITE LOOP. CRAP");
}
@ -261,8 +279,8 @@ namespace BuildEndurance
//loads the data to the variables upon loading the game.
string myname = StardewValley.Game1.player.name;
string mylocation = Path.Combine(PathOnDisk, "BuildEndurance_data_");
string mylocation2 = mylocation+myname;
string mylocation3 = mylocation2+".txt";
string mylocation2 = mylocation + myname;
string mylocation3 = mylocation2 + ".txt";
if (!File.Exists(mylocation3)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
{
Console.WriteLine("Clear Data Loaded could not find the correct file.");
@ -285,6 +303,34 @@ namespace BuildEndurance
}
}
void Clear_Checker()
{
//loads the data to the variables upon loading the game.
string myname = StardewValley.Game1.player.name;
string mylocation = Path.Combine(PathOnDisk, "BuildEndurance_data_");
string mylocation2 = mylocation + myname;
string mylocation3 = mylocation2 + ".txt";
if (!File.Exists(mylocation3)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
{
Console.WriteLine("Clear Data Loaded could not find the correct file.");
BuildEndurance_data_clear_mod_effects = false;
BuildEndurance_data_old_stamina = 0;
BuildEndurance_data_ini_stam_bonus = 0;
//return;
}
else
{
//loads the BuildEndurance_data upon loading the mod
string[] readtext = File.ReadAllLines(mylocation3);
BuildEndurance_data_clear_mod_effects = Convert.ToBoolean(readtext[14]);
}
}
@ -332,7 +378,7 @@ namespace BuildEndurance
string mylocation = Path.Combine(PathOnDisk, "BuildEndurance_data_");
string mylocation2 = mylocation + myname;
string mylocation3 = mylocation2 + ".txt";
string[] mystring3= new string[20];
string[] mystring3 = new string[20];
if (!File.Exists(mylocation3))
{
Console.WriteLine("The data file for BuildEndurance was not found, guess I'll create it when you sleep.");

View File

@ -2,12 +2,12 @@
"Name": "BuildEndurance",
"Authour": "Alpha_Omegasis",
"Version": {
"MajorVersion": 0,
"MajorVersion": 1,
"MinorVersion": 0,
"PatchVersion": 1,
"PatchVersion": 0,
"Build": ""
},
"Description": "SMAPI port of BuildEndurance. Increase your health as you play.",
"Description": "SMAPI port of BuildEndurance. Increase your health as you play. Updated to support per-character values.",
"UniqueID": "4be88c18-b6f3-49b0-ba96-f94b1a5be890",
"PerSaveConfigs": false,
"EntryDll": "SMAPI_BuildEndurance.dll"

View File

@ -89,7 +89,7 @@ namespace BuildHealth
if (tool_cleaner == true) return;
if (StardewModdingAPI.Entities.SPlayer.CurrentFarmer.usingTool == true)
if (StardewValley.Game1.player.usingTool == true)
{
//Console.WriteLine("Tool is being used");
BuildHealth_data_xp_current += ModConfig.BuildHealth_xp_tooluse;
@ -133,8 +133,8 @@ namespace BuildHealth
{
if(upon_loading ==true){
Clear_DataLoader();
//This will run when the character goes to sleep. It will increase their sleeping skill.
Clear_Checker();
var player = StardewValley.Game1.player;
BuildHealth_data_xp_current += ModConfig.BuildHealth_xp_sleeping;
@ -146,6 +146,8 @@ namespace BuildHealth
if (BuildHealth_data_clear_mod_effects == true)
{
Clear_DataLoader();
//This will run when the character goes to sleep. It will increase their sleeping skill.
player.maxHealth = BuildHealth_data_old_health;
BuildHealth_data_xp_nextlvl = ModConfig.BuildHealth_xp_nextlvl;
BuildHealth_data_xp_current = ModConfig.BuildHealth_xp_current;
@ -263,8 +265,32 @@ namespace BuildHealth
}
}
void Clear_Checker()
{
//loads the data to the variables upon loading the game.
string myname = StardewValley.Game1.player.name;
string mylocation = Path.Combine(PathOnDisk, "BuildHealth_data_");
string mylocation2 = mylocation + myname;
string mylocation3 = mylocation2 + ".txt";
if (!File.Exists(mylocation3)) //if not data.json exists, initialize the data variables to the ModConfig data. I.E. starting out.
{
Console.WriteLine("The config file for BuildHealth was not found, guess I'll create it...");
BuildHealth_data_clear_mod_effects = false;
BuildHealth_data_old_health = 0;
BuildHealth_data_ini_health_bonus = 0;
}
else
{
//loads the BuildHealth_data upon loading the mod
string[] readtext = File.ReadAllLines(mylocation3);
BuildHealth_data_clear_mod_effects = Convert.ToBoolean(readtext[14]);
}
}
void DataLoader()
{

Binary file not shown.

View File

@ -2,9 +2,9 @@
"Name": "BuildHealth",
"Authour": "Alpha_Omegasis",
"Version": {
"MajorVersion": 0,
"MajorVersion": 1,
"MinorVersion": 0,
"PatchVersion": 1,
"PatchVersion": 0,
"Build": ""
},
"Description": "SMAPI port of BuildHealth. Increase your health as you play.",