From 8f0f692a60d658aedc6f2b4a539d9d5b4d9a1620 Mon Sep 17 00:00:00 2001 From: Date: Mon, 25 Jun 2018 21:13:40 -0700 Subject: [PATCH] Fixed Game1.shouldFarmerPassOut issue, need to test night owl, started fixing Happy bday, need to update SimpleSoundManager --- GeneralMods/BuildEndurance/BuildEndurance.cs | 17 ++++++++++++++--- GeneralMods/BuildHealth/BuildHealth.cs | 9 +++++++-- GeneralMods/HappyBirthday/HappyBirthday.cs | 3 ++- GeneralMods/NightOwl/NightOwl.cs | 15 ++++++++++++--- .../SimpleSoundManager/{ => Framework}/Sound.cs | 2 +- .../{ => Framework}/SoundManager.cs | 7 ++++++- .../{ => Framework}/WavSound.cs | 0 .../{ => Framework}/XACTSound.cs | 2 +- .../{ => Framework}/XactMusicPair.cs | 0 .../StardustCore/Objects/MultiTileObject.cs | 2 ++ 10 files changed, 45 insertions(+), 12 deletions(-) rename GeneralMods/SimpleSoundManager/{ => Framework}/Sound.cs (95%) rename GeneralMods/SimpleSoundManager/{ => Framework}/SoundManager.cs (97%) rename GeneralMods/SimpleSoundManager/{ => Framework}/WavSound.cs (100%) rename GeneralMods/SimpleSoundManager/{ => Framework}/XACTSound.cs (98%) rename GeneralMods/SimpleSoundManager/{ => Framework}/XactMusicPair.cs (100%) diff --git a/GeneralMods/BuildEndurance/BuildEndurance.cs b/GeneralMods/BuildEndurance/BuildEndurance.cs index edc64517..763e619a 100644 --- a/GeneralMods/BuildEndurance/BuildEndurance.cs +++ b/GeneralMods/BuildEndurance/BuildEndurance.cs @@ -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); } } + + /// + /// Try and emulate the old Game1.shouldFarmerPassout logic. + /// + /// + public bool shouldFarmerPassout() + { + if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true; + else return false; + } } } diff --git a/GeneralMods/BuildHealth/BuildHealth.cs b/GeneralMods/BuildHealth/BuildHealth.cs index b263fc01..1ba8210c 100644 --- a/GeneralMods/BuildHealth/BuildHealth.cs +++ b/GeneralMods/BuildHealth/BuildHealth.cs @@ -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; + } } } diff --git a/GeneralMods/HappyBirthday/HappyBirthday.cs b/GeneralMods/HappyBirthday/HappyBirthday.cs index 6eca492f..162e05ed 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.cs +++ b/GeneralMods/HappyBirthday/HappyBirthday.cs @@ -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; diff --git a/GeneralMods/NightOwl/NightOwl.cs b/GeneralMods/NightOwl/NightOwl.cs index d66bf81d..d0a354fd 100644 --- a/GeneralMods/NightOwl/NightOwl.cs +++ b/GeneralMods/NightOwl/NightOwl.cs @@ -160,7 +160,7 @@ namespace Omegasis.NightOwl string[] passOutFees = Game1.player.mailbox .Where(p => p.Contains("passedOut")) .ToArray(); - for (int idx=0; idx + /// Try and emulate the old Game1.shouldFarmerPassout logic. + /// + /// + public bool shouldFarmerPassout() + { + if (Game1.player.stamina <= 0 || Game1.player.health <= 0 || Game1.timeOfDay >= 2600) return true; + else return false; + } } } diff --git a/GeneralMods/SimpleSoundManager/Sound.cs b/GeneralMods/SimpleSoundManager/Framework/Sound.cs similarity index 95% rename from GeneralMods/SimpleSoundManager/Sound.cs rename to GeneralMods/SimpleSoundManager/Framework/Sound.cs index 33fe9088..7524e046 100644 --- a/GeneralMods/SimpleSoundManager/Sound.cs +++ b/GeneralMods/SimpleSoundManager/Framework/Sound.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SimpleSoundManager +namespace SimpleSoundManager.Framework { /// /// Interface used for common sound functionality; diff --git a/GeneralMods/SimpleSoundManager/SoundManager.cs b/GeneralMods/SimpleSoundManager/Framework/SoundManager.cs similarity index 97% rename from GeneralMods/SimpleSoundManager/SoundManager.cs rename to GeneralMods/SimpleSoundManager/Framework/SoundManager.cs index e60d811d..8fd53482 100644 --- a/GeneralMods/SimpleSoundManager/SoundManager.cs +++ b/GeneralMods/SimpleSoundManager/Framework/SoundManager.cs @@ -7,8 +7,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SimpleSoundManager +namespace SimpleSoundManager.Framework { + + /// + /// TODO: + /// Play, stop, pause songs. + /// class SoundManager { diff --git a/GeneralMods/SimpleSoundManager/WavSound.cs b/GeneralMods/SimpleSoundManager/Framework/WavSound.cs similarity index 100% rename from GeneralMods/SimpleSoundManager/WavSound.cs rename to GeneralMods/SimpleSoundManager/Framework/WavSound.cs diff --git a/GeneralMods/SimpleSoundManager/XACTSound.cs b/GeneralMods/SimpleSoundManager/Framework/XACTSound.cs similarity index 98% rename from GeneralMods/SimpleSoundManager/XACTSound.cs rename to GeneralMods/SimpleSoundManager/Framework/XACTSound.cs index b486017a..196d34d2 100644 --- a/GeneralMods/SimpleSoundManager/XACTSound.cs +++ b/GeneralMods/SimpleSoundManager/Framework/XACTSound.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SimpleSoundManager +namespace SimpleSoundManager.Framework { public class XACTSound : Sound { diff --git a/GeneralMods/SimpleSoundManager/XactMusicPair.cs b/GeneralMods/SimpleSoundManager/Framework/XactMusicPair.cs similarity index 100% rename from GeneralMods/SimpleSoundManager/XactMusicPair.cs rename to GeneralMods/SimpleSoundManager/Framework/XactMusicPair.cs diff --git a/GeneralMods/StardustCore/Objects/MultiTileObject.cs b/GeneralMods/StardustCore/Objects/MultiTileObject.cs index 13ec1c0a..63085359 100644 --- a/GeneralMods/StardustCore/Objects/MultiTileObject.cs +++ b/GeneralMods/StardustCore/Objects/MultiTileObject.cs @@ -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