Fixed Game1.shouldFarmerPassOut issue, need to test night owl, started fixing Happy bday, need to update SimpleSoundManager

This commit is contained in:
2018-06-25 21:13:40 -07:00
parent 349d053727
commit 8f0f692a60
10 changed files with 45 additions and 12 deletions

View File

@ -99,7 +99,7 @@ namespace Omegasis.BuildEndurance
}
// give XP when exhausted
if (!this.WasExhausted && Game1.player.exhausted)
if (!this.WasExhausted && Game1.player.exhausted.Value)
{
this.PlayerData.CurrentExp += this.Config.ExpForExhaustion;
this.WasExhausted = true;
@ -107,8 +107,9 @@ namespace Omegasis.BuildEndurance
}
// give XP when player stays up too late or collapses
if (!this.WasCollapsed && Game1.farmerShouldPassOut)
if (!this.WasCollapsed && shouldFarmerPassout())
{
this.PlayerData.CurrentExp += this.Config.ExpForCollapsing;
this.WasCollapsed = true;
//this.Monitor.Log("The player has collapsed!");
@ -180,7 +181,7 @@ namespace Omegasis.BuildEndurance
}
}
this.PlayerData.ClearModEffects = false;
this.PlayerData.NightlyStamina = Game1.player.maxStamina;
this.PlayerData.NightlyStamina = Game1.player.MaxStamina;
// save data
this.Helper.WriteJsonFile(this.DataFilePath, this.PlayerData);
@ -219,5 +220,15 @@ namespace Omegasis.BuildEndurance
this.Monitor.Log($"Error migrating data from the legacy 'PlayerData' folder for the current player. Technical details:\n {ex}", LogLevel.Error);
}
}
/// <summary>
/// Try and emulate the old Game1.shouldFarmerPassout logic.
/// </summary>
/// <returns></returns>
public bool shouldFarmerPassout()
{
if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true;
else return false;
}
}
}

View File

@ -103,11 +103,10 @@ namespace Omegasis.BuildHealth
this.LastHealth = player.health;
// give XP when player stays up too late or collapses
if (!this.WasCollapsed && Game1.farmerShouldPassOut)
if (!this.WasCollapsed && shouldFarmerPassout())
{
this.PlayerData.CurrentExp += this.Config.ExpForCollapsing;
this.WasCollapsed = true;
this.Monitor.Log("The player has collapsed!");
}
}
@ -210,5 +209,11 @@ namespace Omegasis.BuildHealth
this.Monitor.Log($"Error migrating data from the legacy 'PlayerData' folder for the current player. Technical details:\n {ex}", LogLevel.Error);
}
}
public bool shouldFarmerPassout()
{
if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true;
else return false;
}
}
}

View File

@ -147,6 +147,7 @@ namespace Omegasis.HappyBirthday
private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e)
{
// show birthday selection menu
if (Game1.activeClickableMenu != null) return;
if (Context.IsPlayerFree && !this.HasChosenBirthday && e.KeyPressed.ToString() == this.Config.KeyBinding)
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
}
@ -240,7 +241,7 @@ namespace Omegasis.HappyBirthday
if (Game1.activeClickableMenu.GetType() == typeof(BirthdayMenu)) return;
}
// ask for birthday date
if (!this.HasChosenBirthday)
if (!this.HasChosenBirthday && Game1.activeClickableMenu==null)
{
Game1.activeClickableMenu = new BirthdayMenu(this.PlayerData.BirthdaySeason, this.PlayerData.BirthdayDay, this.SetBirthday);
this.CheckedForBirthday = false;

View File

@ -160,7 +160,7 @@ namespace Omegasis.NightOwl
string[] passOutFees = Game1.player.mailbox
.Where(p => p.Contains("passedOut"))
.ToArray();
for (int idx=0; idx<pofees.Length; idx++)
for (int idx=0; idx< passOutFees.Length; idx++)
{
string[] msg = passOutFees[idx].Split(' ');
collapseFee += Int32.Parse(msg[1]);
@ -192,7 +192,6 @@ namespace Omegasis.NightOwl
{
// reset data
this.IsUpLate = false;
Game1.farmerShouldPassOut = false;
// transition to the next day
if (this.ShouldResetPlayerAfterCollapseNow)
@ -355,7 +354,7 @@ namespace Omegasis.NightOwl
if (Game1.currentMinigame != null)
Game1.currentMinigame = null;
Game1.farmerShouldPassOut = true;
Game1.player.startToPassOut();
}
@ -386,5 +385,15 @@ namespace Omegasis.NightOwl
string path = Path.Combine(this.Helper.DirectoryPath, "Error_Logs", "Mod_State.json");
this.Helper.WriteJsonFile(path, state);
}
/// <summary>
/// Try and emulate the old Game1.shouldFarmerPassout logic.
/// </summary>
/// <returns></returns>
public bool shouldFarmerPassout()
{
if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true;
else return false;
}
}
}

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleSoundManager
namespace SimpleSoundManager.Framework
{
/// <summary>
/// Interface used for common sound functionality;

View File

@ -7,8 +7,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleSoundManager
namespace SimpleSoundManager.Framework
{
/// <summary>
/// TODO:
/// Play, stop, pause songs.
/// </summary>
class SoundManager
{

View File

@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleSoundManager
namespace SimpleSoundManager.Framework
{
public class XACTSound : Sound
{

View File

@ -196,6 +196,8 @@ namespace StardustCore.Objects
{
if (animationManager == null)
{
//FIX SCALE SIZE AND POSITION APPROPRIATELY DEPENDING ON # OF OBJECTS!!!
aosdkpoasdopjsa
spriteBatch.Draw(v.Value.getExtendedTexture().getTexture(), location+new Vector2(v.Key.X*16,v.Key.Y*16), this.defaultSourceRect, Color.White * transparency, 0f, new Vector2(0, 0), 1, SpriteEffects.None, layerDepth);
}
else