From f0e1e696f9f465e48d958735dbd1a6cee7b13537 Mon Sep 17 00:00:00 2001 From: Date: Thu, 14 Sep 2017 13:49:19 -0700 Subject: [PATCH] Made Planter Boxes be a possible greenhouse, self watering, dead crops work again and are removed automatical per mod config, and dead crops can be removed by tools. --- .../AdditionalCropsFramework.csproj | 2 +- .../Framework/Config.cs | 19 + .../Framework/Utilities.cs | 50 +- .../Menus/ShippingMenu.cs | 756 ------------------ .../AdditionalCropsFramework/ModCore.cs | 34 +- .../AdditionalCropsFramework/PlanterBox.cs | 122 ++- .../RuneFactoryCropsMod/PlanterBox.xnb | Bin 1114 -> 1124 bytes GeneralMods/StardustCore/Utilities.cs | 103 +++ 8 files changed, 258 insertions(+), 828 deletions(-) create mode 100644 GeneralMods/AdditionalCropsFramework/Framework/Config.cs delete mode 100644 GeneralMods/AdditionalCropsFramework/Menus/ShippingMenu.cs diff --git a/GeneralMods/AdditionalCropsFramework/AdditionalCropsFramework.csproj b/GeneralMods/AdditionalCropsFramework/AdditionalCropsFramework.csproj index 7f34b03a..96665538 100644 --- a/GeneralMods/AdditionalCropsFramework/AdditionalCropsFramework.csproj +++ b/GeneralMods/AdditionalCropsFramework/AdditionalCropsFramework.csproj @@ -49,8 +49,8 @@ + - diff --git a/GeneralMods/AdditionalCropsFramework/Framework/Config.cs b/GeneralMods/AdditionalCropsFramework/Framework/Config.cs new file mode 100644 index 00000000..e19cb098 --- /dev/null +++ b/GeneralMods/AdditionalCropsFramework/Framework/Config.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AdditionalCropsFramework.Framework +{ + public class Config + { + public bool removeCropsDayofDying; + + public Config() + { + + } + + } +} diff --git a/GeneralMods/AdditionalCropsFramework/Framework/Utilities.cs b/GeneralMods/AdditionalCropsFramework/Framework/Utilities.cs index 7a780b08..5e61480a 100644 --- a/GeneralMods/AdditionalCropsFramework/Framework/Utilities.cs +++ b/GeneralMods/AdditionalCropsFramework/Framework/Utilities.cs @@ -736,20 +736,17 @@ namespace AdditionalCropsFramework return false; } - public static void cropNewDay(Crop c,int state, int fertilizer, int xTile, int yTile, GameLocation environment) + public static void cropNewDay(PlanterBox p,Crop c,int state, int fertilizer, int xTile, int yTile, GameLocation environment) { - /* - if ((c.dead || !c.seasonsToGrowIn.Contains(Game1.currentSeason))) + if (p.greenHouseEffect == false) { - c.dead = true; + if ((c.dead || !c.seasonsToGrowIn.Contains(Game1.currentSeason))) + { + c.dead = true; + } } - */ - if (1 == 0) - { - } - else - { + if (state == 1) { c.dayOfCurrentPhase++; @@ -823,26 +820,22 @@ namespace AdditionalCropsFramework if (environment.terrainFeatures[index] == null || !(environment.terrainFeatures[index] is HoeDirt)) return; (environment.terrainFeatures[index] as HoeDirt).crop = (Crop)null; - } + } - public static void cropNewDayModded(ModularCrop c, int state, int fertilizer, int xTile, int yTile, GameLocation environment) + public static void cropNewDayModded(PlanterBox p,ModularCrop c, int state, int fertilizer, int xTile, int yTile, GameLocation environment) { - /* - if ((c.dead || !c.seasonsToGrowIn.Contains(Game1.currentSeason))) + if (p.greenHouseEffect == false) { - c.dead = true; + if ((c.dead || !c.seasonsToGrowIn.Contains(Game1.currentSeason))) + { + c.dead = true; + } } - */ - if (1 == 0) - { - } - else - { if (state == 1) { c.dayOfCurrentPhase++; @@ -911,7 +904,7 @@ namespace AdditionalCropsFramework if (environment.terrainFeatures[index] == null || !(environment.terrainFeatures[index] is HoeDirt)) return; (environment.terrainFeatures[index] as HoeDirt).crop = (Crop)null; - } + } @@ -923,7 +916,12 @@ namespace AdditionalCropsFramework if (Game1.player.addItemToInventoryBool(I, false)) { Vector2 vector2 = new Vector2((float)xTile, (float)yTile); - Game1.player.animateOnce(279 + Game1.player.facingDirection); + + if (Game1.player.CurrentItem == null) + { + // Game1.player.animateOnce(279 + Game1.player.facingDirection); + // StardustCore.Utilities.animateOnce(Game1.player, 279 + Game1.player.facingDirection, 10f, 6, null, false, false, false); + } Game1.player.canMove = false; Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); @@ -1121,7 +1119,11 @@ namespace AdditionalCropsFramework if (Game1.player.addItemToInventoryBool(I, false)) { Vector2 vector2 = new Vector2((float)xTile, (float)yTile); - Game1.player.animateOnce(279 + Game1.player.facingDirection); + if (Game1.player.CurrentItem == null) + { + // Game1.player.animateOnce(279 + Game1.player.facingDirection); + // StardustCore.Utilities.animateOnce(Game1.player, 279 + Game1.player.facingDirection, 10f, 6, null, false, false, false); + } Game1.player.canMove = false; Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); diff --git a/GeneralMods/AdditionalCropsFramework/Menus/ShippingMenu.cs b/GeneralMods/AdditionalCropsFramework/Menus/ShippingMenu.cs deleted file mode 100644 index 2982fd23..00000000 --- a/GeneralMods/AdditionalCropsFramework/Menus/ShippingMenu.cs +++ /dev/null @@ -1,756 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using StardewValley; -using StardewValley.Menus; -using StardewValley.BellsAndWhistles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Graphics; -using StardewModdingAPI; - -namespace AdditionalCropsFramework.Menus -{ - class ShippingMenuExpanded : StardewValley.Menus.ShippingMenu - { - - public int currentPage = -1; - public List categories = new List(); - private List categoryTotals = new List(); - private List categoryDials = new List(); - private List> categoryItems = new List>(); - private int introTimer = 3500; - public List animations = new List(); - public const int region_okbutton = 101; - public const int region_forwardButton = 102; - public const int region_backButton = 103; - public const int farming_category = 0; - public const int foraging_category = 1; - public const int fishing_category = 2; - public const int mining_category = 3; - public const int other_category = 4; - public const int total_category = 5; - public const int timePerIntroCategory = 500; - public const int outroFadeTime = 800; - public const int smokeRate = 100; - public const int categorylabelHeight = 25; - public const int itemsPerCategoryPage = 9; - public int currentTab; - public ClickableTextureComponent okButton; - public ClickableTextureComponent forwardButton; - public ClickableTextureComponent backButton; - private int categoryLabelsWidth; - private int plusButtonWidth; - private int itemSlotWidth; - private int itemAndPlusButtonWidth; - private int totalWidth; - private int centerX; - private int centerY; - private int outroFadeTimer; - private int outroPauseBeforeDateChange; - private int finalOutroTimer; - private int smokeTimer; - private int dayPlaqueY; - private float weatherX; - private bool outro; - private bool newDayPlaque; - private bool savedYet; - private SaveGameMenu saveGameMenu; - - public ShippingMenuExpanded(List items) : base(items) - { - this.parseItems(items); - if (!Game1.wasRainingYesterday) - Game1.changeMusicTrack(Game1.currentSeason.Equals("summer") ? "nightTime" : "none"); - this.categoryLabelsWidth = Game1.tileSize * 8; - this.plusButtonWidth = 10 * Game1.pixelZoom; - this.itemSlotWidth = 24 * Game1.pixelZoom; - this.itemAndPlusButtonWidth = this.plusButtonWidth + this.itemSlotWidth + 2 * Game1.pixelZoom; - this.totalWidth = this.categoryLabelsWidth + this.itemAndPlusButtonWidth; - this.centerX = Game1.viewport.Width / 2; - this.centerY = Game1.viewport.Height / 2; - int num1 = -1; - for (int index = 0; index < 6; ++index) - { - List categories = this.categories; - ClickableTextureComponent textureComponent = new ClickableTextureComponent("", new Rectangle(this.centerX + this.totalWidth / 2 - this.plusButtonWidth, this.centerY - 25 * Game1.pixelZoom * 3 + index * 27 * Game1.pixelZoom, this.plusButtonWidth, 11 * Game1.pixelZoom), "", this.getCategoryName(index), Game1.mouseCursors, new Rectangle(392, 361, 10, 11), (float)Game1.pixelZoom, false); - int num2 = index >= 5 ? 0 : (this.categoryItems[index].Count > 0 ? 1 : 0); - textureComponent.visible = num2 != 0; - int num3 = index; - textureComponent.myID = num3; - int num4 = index < 4 ? index + 1 : 101; - textureComponent.downNeighborID = num4; - int num5 = index > 0 ? num1 : -1; - textureComponent.upNeighborID = num5; - int num6 = 1; - textureComponent.upNeighborImmutable = num6 != 0; - categories.Add(textureComponent); - num1 = index >= 5 || this.categoryItems[index].Count <= 0 ? num1 : index; - } - this.dayPlaqueY = this.categories[0].bounds.Y - Game1.tileSize * 2; - Rectangle bounds = new Rectangle(this.centerX + this.totalWidth / 2 - this.itemAndPlusButtonWidth + Game1.tileSize / 2, this.centerY + 25 * Game1.pixelZoom * 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize); - ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11382"), bounds, (string)null, Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11382"), Game1.mouseCursors, new Rectangle(128, 256, 64, 64), 1f, false); - int num7 = 101; - textureComponent1.myID = num7; - int num8 = num1; - textureComponent1.upNeighborID = num8; - this.okButton = textureComponent1; - if (Game1.options.gamepadControls) - { - Mouse.SetPosition(bounds.Center.X, bounds.Center.Y); - Game1.lastCursorMotionWasMouse = false; - } - ClickableTextureComponent textureComponent2 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen + this.height - 16 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), (string)null, "", Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false); - int num9 = 103; - textureComponent2.myID = num9; - int num10 = -7777; - textureComponent2.rightNeighborID = num10; - this.backButton = textureComponent2; - ClickableTextureComponent textureComponent3 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - 16 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), (string)null, "", Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false); - int num11 = 102; - textureComponent3.myID = num11; - int num12 = 103; - textureComponent3.leftNeighborID = num12; - this.forwardButton = textureComponent3; - if (Game1.dayOfMonth == 25 && Game1.currentSeason.Equals("winter")) - { - Vector2 position = new Vector2((float)Game1.viewport.Width, (float)Game1.random.Next(0, 200)); - Rectangle sourceRect = new Rectangle(640, 800, 32, 16); - int numberOfLoops = 1000; - this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, 80f, 2, numberOfLoops, position, false, false, 0.01f, 0.0f, Color.White, 4f, 0.0f, 0.0f, 0.0f, true) - { - motion = new Vector2(-4f, 0.0f), - delayBeforeAnimationStart = 3000 - }); - } - Game1.stats.checkForShippingAchievements(); - if (!Game1.player.achievements.Contains(34) && Utility.hasFarmerShippedAllItems()) - Game1.getAchievement(34); - if (!Game1.options.SnappyMenus) - return; - this.populateClickableComponentList(); - this.snapToDefaultClickableComponent(); - } - - protected override void customSnapBehavior(int direction, int oldRegion, int oldID) - { - if (oldID != 103 || direction != 1 || !this.showForwardButton()) - return; - this.currentlySnappedComponent = this.getComponentWithID(102); - this.snapCursorToCurrentSnappedComponent(); - } - - public override void snapToDefaultClickableComponent() - { - this.currentlySnappedComponent = this.getComponentWithID(101); - this.snapCursorToCurrentSnappedComponent(); - } - - public new void parseItems(List items) - { - Log.AsyncY("PARSE IT!!!"); - Utility.consolidateStacks(items); - for (int index = 0; index < 6; ++index) - { - this.categoryItems.Add(new List()); - this.categoryTotals.Add(0); - this.categoryDials.Add(new MoneyDial(7, index == 5)); - } - foreach (Item obj in items) - { - // Log.AsyncY("I AM A BUTTERFLY. KILL ME"+obj.Name); - - if (obj is StardewValley.Object) - { - // Log.AsyncG("I DON't UNDERSTAND"); - int categoryIndexForObject = this.getCategoryIndexForObject((obj as StardewValley.Object)); - this.categoryItems[categoryIndexForObject].Add((Item)(obj as StardewValley.Object)); - List categoryTotals = this.categoryTotals; - int index = categoryIndexForObject; - if (obj is StardustCore.CoreObject) - { - categoryTotals[index] = categoryTotals[index] + StardustCore.Utilities.sellToStorePrice((obj as StardustCore.CoreObject)) * (obj as StardustCore.CoreObject).Stack; - // Log.AsyncY("CORE"); - } - else - { - // Log.AsyncY("VANILLA"); - categoryTotals[index] = categoryTotals[index] + (obj as StardewValley.Object).sellToStorePrice() * (obj as StardewValley.Object).Stack; - } - Game1.stats.itemsShipped += (uint)(obj as StardewValley.Object).Stack; - if ((obj as StardewValley.Object).Category == -75 || (obj as StardewValley.Object).Category == -79) - Game1.stats.CropsShipped += (uint)(obj as StardewValley.Object).Stack; - if ((obj as StardewValley.Object).countsForShippedCollection()) - Game1.player.shippedBasic((obj as StardewValley.Object).parentSheetIndex, (obj as StardewValley.Object).stack); - } - else if (obj is StardustCore.CoreObject) - { - Log.AsyncG("WTFFFFFFF PRICE :"); - - int categoryIndexForObject = this.getCategoryIndexForObject((obj as StardustCore.CoreObject)); - this.categoryItems[categoryIndexForObject].Add((Item)(obj as StardustCore.CoreObject)); - List categoryTotals = this.categoryTotals; - int index = categoryIndexForObject; - categoryTotals[index] = categoryTotals[index] + StardustCore.Utilities.sellToStorePrice((obj as StardustCore.CoreObject)) * (obj as StardustCore.CoreObject).Stack; - Game1.stats.itemsShipped += (uint)(obj as StardustCore.CoreObject).Stack; - if ((obj as StardustCore.CoreObject).Category == -75 || (obj as StardewValley.Object).Category == -79) - Game1.stats.CropsShipped += (uint)(obj as StardustCore.CoreObject).Stack; - if ((obj as StardustCore.CoreObject).countsForShippedCollection()) - Game1.player.shippedBasic((obj as StardustCore.CoreObject).parentSheetIndex, (obj as StardustCore.CoreObject).stack); - } - else if(obj is AdditionalCropsFramework.ModularCropObject) - { - Log.AsyncG("PRICES BISCUITS!!!"); - categoryTotals[5] += obj.salePrice(); - - } - else if(obj is Item) - { - Log.AsyncG("PRICES PUPPERS!!!"); - categoryTotals[5] += obj.salePrice(); - } - } - for (int index = 0; index < 5; ++index) - { - List categoryTotals = this.categoryTotals; - categoryTotals[5] = categoryTotals[5] + this.categoryTotals[index]; - this.categoryItems[5].AddRange((IEnumerable)this.categoryItems[index]); - this.categoryDials[index].currentValue = this.categoryTotals[index]; - this.categoryDials[index].previousTargetValue = this.categoryDials[index].currentValue; - } - this.categoryDials[5].currentValue = this.categoryTotals[5]; - Game1.player.Money += this.categoryTotals[5]; - Game1.setRichPresence("earnings", (object)this.categoryTotals[5]); - } - - public int getCategoryIndexForObject(StardewValley.Object o) - { - switch (o.parentSheetIndex) - { - case 414: - case 418: - case 406: - case 410: - case 296: - case 396: - case 402: - return 1; - default: - switch (o.category) - { - case -20: - case -4: - return 2; - case -15: - case -12: - case -2: - return 3; - case -14: - case -6: - case -5: - case -80: - case -79: - case -75: - case -26: - return 0; - case -81: - case -27: - case -23: - return 1; - default: - return 4; - } - } - } - - public string getCategoryName(int index) - { - switch (index) - { - case 0: - return Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11389"); - case 1: - return Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11390"); - case 2: - return Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11391"); - case 3: - return Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11392"); - case 4: - return Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11393"); - case 5: - return Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11394"); - default: - return ""; - } - } - - public override void update(GameTime time) - { - base.update(time); - if (this.saveGameMenu != null) - { - this.saveGameMenu.update(time); - if (this.saveGameMenu.quit) - { - this.saveGameMenu = (SaveGameMenu)null; - this.savedYet = true; - } - } - this.weatherX = this.weatherX + (float)time.ElapsedGameTime.Milliseconds * 0.03f; - for (int index = this.animations.Count - 1; index >= 0; --index) - { - if (this.animations[index].update(time)) - this.animations.RemoveAt(index); - } - if (this.outro) - { - if (this.outroFadeTimer > 0) - this.outroFadeTimer = this.outroFadeTimer - time.ElapsedGameTime.Milliseconds; - else if (this.outroFadeTimer <= 0 && this.dayPlaqueY < this.centerY - Game1.tileSize) - { - if (this.animations.Count > 0) - this.animations.Clear(); - this.dayPlaqueY = this.dayPlaqueY + (int)Math.Ceiling((double)time.ElapsedGameTime.Milliseconds * 0.349999994039536); - if (this.dayPlaqueY >= this.centerY - Game1.tileSize) - this.outroPauseBeforeDateChange = 700; - } - else if (this.outroPauseBeforeDateChange > 0) - { - this.outroPauseBeforeDateChange = this.outroPauseBeforeDateChange - time.ElapsedGameTime.Milliseconds; - if (this.outroPauseBeforeDateChange <= 0) - { - this.newDayPlaque = true; - Game1.playSound("newRecipe"); - if (!Game1.currentSeason.Equals("winter")) - DelayedAction.playSoundAfterDelay(Game1.isRaining ? "rainsound" : "rooster", 1500); - this.finalOutroTimer = 2000; - this.animations.Clear(); - if (!this.savedYet) - { - if (this.saveGameMenu != null) - return; - this.saveGameMenu = new SaveGameMenu(); - return; - } - } - } - else if (this.finalOutroTimer > 0 && this.savedYet) - { - this.finalOutroTimer = this.finalOutroTimer - time.ElapsedGameTime.Milliseconds; - if (this.finalOutroTimer <= 0) - this.exitThisMenu(false); - } - } - if (this.introTimer >= 0) - { - int introTimer = this.introTimer; - this.introTimer = this.introTimer - time.ElapsedGameTime.Milliseconds * (Game1.oldMouseState.LeftButton == ButtonState.Pressed ? 3 : 1); - int num = 500; - if (introTimer % num < this.introTimer % 500 && this.introTimer <= 3000) - { - int which = 4 - this.introTimer / 500; - if (which < 6 && which > -1) - { - if (this.categoryItems[which].Count > 0) - { - Game1.playSound(this.getCategorySound(which)); - this.categoryDials[which].currentValue = 0; - this.categoryDials[which].previousTargetValue = 0; - } - else - Game1.playSound("stoneStep"); - } - } - if (this.introTimer >= 0) - return; - Game1.playSound("money"); - this.categoryDials[5].currentValue = 0; - this.categoryDials[5].previousTargetValue = 0; - } - else - { - if (Game1.dayOfMonth == 28 || this.outro) - return; - if (!Game1.wasRainingYesterday) - { - Vector2 position = new Vector2((float)Game1.viewport.Width, (float)Game1.random.Next(200)); - Rectangle sourceRect = new Rectangle(640, 752, 16, 16); - int num1 = Game1.random.Next(1, 4); - if (Game1.random.NextDouble() < 0.001) - { - bool flipped = Game1.random.NextDouble() < 0.5; - if (Game1.random.NextDouble() < 0.5) - { - List animations = this.animations; - TemporaryAnimatedSprite temporaryAnimatedSprite = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(640, 826, 16, 8), 40f, 4, 0, new Vector2((float)Game1.random.Next(this.centerX * 2), (float)Game1.random.Next(this.centerY)), false, flipped); - temporaryAnimatedSprite.rotation = 3.141593f; - double pixelZoom = (double)Game1.pixelZoom; - temporaryAnimatedSprite.scale = (float)pixelZoom; - Vector2 vector2 = new Vector2(flipped ? -8f : 8f, 8f); - temporaryAnimatedSprite.motion = vector2; - int num2 = 1; - temporaryAnimatedSprite.local = num2 != 0; - animations.Add(temporaryAnimatedSprite); - } - else - { - List animations = this.animations; - TemporaryAnimatedSprite temporaryAnimatedSprite = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(258, 1680, 16, 16), 40f, 4, 0, new Vector2((float)Game1.random.Next(this.centerX * 2), (float)Game1.random.Next(this.centerY)), false, flipped); - temporaryAnimatedSprite.scale = (float)Game1.pixelZoom; - temporaryAnimatedSprite.motion = new Vector2(flipped ? -8f : 8f, 8f); - int num2 = 1; - temporaryAnimatedSprite.local = num2 != 0; - animations.Add(temporaryAnimatedSprite); - } - } - else if (Game1.random.NextDouble() < 0.0002) - { - position = new Vector2((float)Game1.viewport.Width, (float)Game1.random.Next(4, Game1.tileSize * 4)); - this.animations.Add(new TemporaryAnimatedSprite(Game1.staminaRect, new Rectangle(0, 0, 1, 1), 9999f, 1, 10000, position, false, false, 0.01f, 0.0f, Color.White * (0.25f + (float)Game1.random.NextDouble()), 4f, 0.0f, 0.0f, 0.0f, true) - { - motion = new Vector2(-0.25f, 0.0f) - }); - } - else if (Game1.random.NextDouble() < 5E-05) - { - position = new Vector2((float)Game1.viewport.Width, (float)(Game1.viewport.Height - Game1.tileSize * 3)); - for (int index = 0; index < num1; ++index) - { - this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, (float)Game1.random.Next(60, 101), 4, 100, position + new Vector2((float)((index + 1) * Game1.random.Next(15, 18)), (float)((index + 1) * -20)), false, false, 0.01f, 0.0f, Color.Black, 4f, 0.0f, 0.0f, 0.0f, true) - { - motion = new Vector2(-1f, 0.0f) - }); - this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, (float)Game1.random.Next(60, 101), 4, 100, position + new Vector2((float)((index + 1) * Game1.random.Next(15, 18)), (float)((index + 1) * 20)), false, false, 0.01f, 0.0f, Color.Black, 4f, 0.0f, 0.0f, 0.0f, true) - { - motion = new Vector2(-1f, 0.0f) - }); - } - } - else if (Game1.random.NextDouble() < 1E-05) - { - sourceRect = new Rectangle(640, 784, 16, 16); - this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, sourceRect, 75f, 4, 1000, position, false, false, 0.01f, 0.0f, Color.White, 4f, 0.0f, 0.0f, 0.0f, true) - { - motion = new Vector2(-3f, 0.0f), - yPeriodic = true, - yPeriodicLoopTime = 1000f, - yPeriodicRange = (float)(Game1.tileSize / 8), - shakeIntensity = 0.5f - }); - } - } - this.smokeTimer = this.smokeTimer - time.ElapsedGameTime.Milliseconds; - if (this.smokeTimer > 0) - return; - this.smokeTimer = 50; - this.animations.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(684, 1075, 1, 1), 1000f, 1, 1000, new Vector2((float)(Game1.tileSize * 2 + Game1.tileSize * 3 / 4 + Game1.pixelZoom * 3), (float)(Game1.viewport.Height - Game1.tileSize * 2 + Game1.pixelZoom * 5)), false, false) - { - color = Game1.wasRainingYesterday ? Color.SlateGray : Color.White, - scale = (float)Game1.pixelZoom, - scaleChange = 0.0f, - alphaFade = 1f / 400f, - motion = new Vector2(0.0f, (float)((double)-Game1.random.Next(25, 75) / 100.0 / 4.0)), - acceleration = new Vector2(-1f / 1000f, 0.0f) - }); - } - } - - public string getCategorySound(int which) - { - switch (which) - { - case 0: - return !(this.categoryItems[0][0] as StardewValley.Object).isAnimalProduct() ? "harvest" : "cluck"; - case 1: - return "leafrustle"; - case 2: - return "button1"; - case 3: - return "hammer"; - case 4: - return "coin"; - case 5: - return "money"; - default: - return "stoneStep"; - } - } - - public override void performHoverAction(int x, int y) - { - base.performHoverAction(x, y); - if (this.currentPage == -1) - { - this.okButton.tryHover(x, y, 0.1f); - foreach (ClickableTextureComponent category in this.categories) - category.sourceRect.X = !category.containsPoint(x, y) ? 392 : 402; - } - else - { - this.backButton.tryHover(x, y, 0.5f); - this.forwardButton.tryHover(x, y, 0.5f); - } - } - - public override void receiveKeyPress(Keys key) - { - if (this.introTimer <= 0 && !Game1.options.gamepadControls && (key.Equals((object)Keys.Escape) || Game1.options.doesInputListContain(Game1.options.menuButton, key))) - { - this.receiveLeftClick(this.okButton.bounds.Center.X, this.okButton.bounds.Center.Y, true); - } - else - { - if (this.introTimer > 0 || Game1.options.gamepadControls && Game1.options.doesInputListContain(Game1.options.menuButton, key)) - return; - base.receiveKeyPress(key); - } - } - - public override void receiveGamePadButton(Buttons b) - { - base.receiveGamePadButton(b); - if (b == Buttons.B && this.currentPage != -1) - { - if (this.currentTab == 0) - { - if (Game1.options.SnappyMenus) - { - this.currentlySnappedComponent = this.getComponentWithID(this.currentPage); - this.snapCursorToCurrentSnappedComponent(); - } - this.currentPage = 0; - } - else - this.currentTab = this.currentTab - 1; - Game1.playSound("shwip"); - } - else - { - if (b != Buttons.Start && b != Buttons.B || (this.currentPage != -1 || this.outro)) - return; - if (this.introTimer <= 0) - this.okClicked(); - else - this.introTimer = this.introTimer - Game1.currentGameTime.ElapsedGameTime.Milliseconds * 2; - } - } - - private void okClicked() - { - this.outro = true; - this.outroFadeTimer = 800; - Game1.playSound("bigDeSelect"); - Game1.changeMusicTrack("none"); - } - - public override void receiveLeftClick(int x, int y, bool playSound = true) - { - if (this.outro && !this.savedYet) - { - SaveGameMenu saveGameMenu = this.saveGameMenu; - } - else - { - if (this.savedYet) - return; - base.receiveLeftClick(x, y, playSound); - if (this.currentPage == -1 && this.introTimer <= 0 && this.okButton.containsPoint(x, y)) - this.okClicked(); - if (this.currentPage == -1) - { - for (int index = 0; index < this.categories.Count; ++index) - { - if (this.categories[index].visible && this.categories[index].containsPoint(x, y)) - { - this.currentPage = index; - Game1.playSound("shwip"); - if (!Game1.options.SnappyMenus) - break; - this.currentlySnappedComponent = this.getComponentWithID(103); - this.snapCursorToCurrentSnappedComponent(); - break; - } - } - } - else if (this.backButton.containsPoint(x, y)) - { - if (this.currentTab == 0) - { - if (Game1.options.SnappyMenus) - { - this.currentlySnappedComponent = this.getComponentWithID(this.currentPage); - this.snapCursorToCurrentSnappedComponent(); - } - this.currentPage = 0; - } - else - this.currentTab = this.currentTab - 1; - Game1.playSound("shwip"); - } - else - { - if (!this.showForwardButton() || !this.forwardButton.containsPoint(x, y)) - return; - this.currentTab = this.currentTab + 1; - Game1.playSound("shwip"); - } - } - } - - public override void receiveRightClick(int x, int y, bool playSound = true) - { - } - - public bool showForwardButton() - { - return this.categoryItems[this.currentPage].Count > 9 * (this.currentTab + 1); - } - - public override void draw(SpriteBatch b) - { - if (Game1.wasRainingYesterday) - { - b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)this.introTimer / 3500.0)); - b.Draw(Game1.mouseCursors, new Rectangle(639 * Game1.pixelZoom, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Game1.currentSeason.Equals("winter") ? Color.LightSlateGray : Color.SlateGray * (float)(1.0 - (double)this.introTimer / 3500.0)); - int num1 = -61 * Game1.pixelZoom; - while (num1 < Game1.viewport.Width + 61 * Game1.pixelZoom) - { - b.Draw(Game1.mouseCursors, new Vector2((float)num1 + this.weatherX / 2f % (float)(61 * Game1.pixelZoom), (float)(Game1.tileSize / 2)), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.DarkSlateGray * 1f * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - num1 += 61 * Game1.pixelZoom; - } - b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(30, 62, 50)) * (float)(0.5 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); - b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(30, 62, 50)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.tileSize * 2 + Game1.tileSize / 2), (float)(Game1.viewport.Height - Game1.tileSize * 2 + Game1.tileSize / 4 + Game1.pixelZoom * 2)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - int num2 = -61 * Game1.pixelZoom; - while (num2 < Game1.viewport.Width + 61 * Game1.pixelZoom) - { - b.Draw(Game1.mouseCursors, new Vector2((float)num2 + this.weatherX % (float)(61 * Game1.pixelZoom), (float)(-Game1.tileSize / 2)), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.SlateGray * 0.85f * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.9f); - num2 += 61 * Game1.pixelZoom; - } - foreach (TemporaryAnimatedSprite animation in this.animations) - animation.draw(b, true, 0, 0); - int num3 = -61 * Game1.pixelZoom; - while (num3 < Game1.viewport.Width + 61 * Game1.pixelZoom) - { - b.Draw(Game1.mouseCursors, new Vector2((float)num3 + this.weatherX * 1.5f % (float)(61 * Game1.pixelZoom), (float)(-Game1.tileSize * 2)), new Rectangle?(new Rectangle(643, 1142, 61, 53)), Color.LightSlateGray * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.9f); - num3 += 61 * Game1.pixelZoom; - } - } - else - { - b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0)); - b.Draw(Game1.mouseCursors, new Rectangle(639 * Game1.pixelZoom, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0)); - b.Draw(Game1.mouseCursors, new Vector2(0.0f, 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), 0.0f), new Rectangle?(new Rectangle(0, 1453, 639, 195)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - if (Game1.dayOfMonth == 28) - b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.viewport.Width - 44 * Game1.pixelZoom), (float)Game1.pixelZoom), new Rectangle?(new Rectangle(642, 835, 43, 43)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 3)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 48)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.25f : new Color(0, 20, 40)) * (float)(0.649999976158142 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.FlipHorizontally, 1f); - b.Draw(Game1.mouseCursors, new Vector2(0.0f, (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(639 * Game1.pixelZoom), (float)(Game1.viewport.Height - Game1.tileSize * 2)), new Rectangle?(new Rectangle(0, Game1.currentSeason.Equals("winter") ? 1034 : 737, 639, 32)), (Game1.currentSeason.Equals("winter") ? Color.White * 0.5f : new Color(0, 32, 20)) * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - b.Draw(Game1.mouseCursors, new Vector2((float)(Game1.tileSize * 2 + Game1.tileSize / 2), (float)(Game1.viewport.Height - Game1.tileSize * 2 + Game1.tileSize / 4 + Game1.pixelZoom * 2)), new Rectangle?(new Rectangle(653, 880, 10, 10)), Color.White * (float)(1.0 - (double)this.introTimer / 3500.0), 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 1f); - } - if (!this.outro && !Game1.wasRainingYesterday) - { - foreach (TemporaryAnimatedSprite animation in this.animations) - animation.draw(b, true, 0, 0); - } - // Log.AsyncC("PAGE "+this.currentPage); - if (this.currentPage == -1) - { - SpriteText.drawStringWithScrollCenteredAt(b, Utility.getDateString(0), Game1.viewport.Width / 2, this.categories[0].bounds.Y - Game1.tileSize * 2, "", 1f, -1, 0, 0.88f, false); - int num = -5 * Game1.pixelZoom; - int index1 = 0; - foreach (ClickableTextureComponent category in this.categories) - { - if (this.introTimer < 2500 - index1 * 500) - { - Vector2 vector2 = category.getVector2() + new Vector2((float)(Game1.pixelZoom * 3), (float)(-Game1.pixelZoom * 2)); - if (category.visible) - { - category.draw(b); - b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-26 * Game1.pixelZoom), (float)(num + Game1.pixelZoom)), new Rectangle?(new Rectangle(293, 360, 24, 24)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.88f); - this.categoryItems[index1][0].drawInMenu(b, vector2 + new Vector2((float)(-22 * Game1.pixelZoom), (float)(num + Game1.pixelZoom * 4)), 1f, 1f, 0.9f, false); - } - IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), (int)((double)vector2.X + (double)-this.itemSlotWidth - (double)this.categoryLabelsWidth - (double)(Game1.pixelZoom * 3)), (int)((double)vector2.Y + (double)num), this.categoryLabelsWidth, 26 * Game1.pixelZoom, Color.White, (float)Game1.pixelZoom, false); - SpriteText.drawString(b, category.hoverText, (int)vector2.X - this.itemSlotWidth - this.categoryLabelsWidth + Game1.pixelZoom * 2, (int)vector2.Y + Game1.pixelZoom, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); - for (int index2 = 0; index2 < 6; ++index2) - b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-this.itemSlotWidth - Game1.tileSize * 3 - Game1.pixelZoom * 6 + index2 * 6 * Game1.pixelZoom), (float)(3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(355, 476, 7, 11)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.88f); - this.categoryDials[index1].draw(b, vector2 + new Vector2((float)(-this.itemSlotWidth - Game1.tileSize * 3 - Game1.pixelZoom * 12 + Game1.pixelZoom), (float)(5 * Game1.pixelZoom)), this.categoryTotals[index1]); - b.Draw(Game1.mouseCursors, vector2 + new Vector2((float)(-this.itemSlotWidth - Game1.tileSize - Game1.pixelZoom), (float)(3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(408, 476, 9, 11)), Color.White, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, 0.88f); - } - ++index1; - } - if (this.introTimer <= 0) - this.okButton.draw(b); - } - else - { - IClickableMenu.drawTextureBox(b, Game1.viewport.Width / 2 - 640, Game1.viewport.Height / 2 - 360, 1280, 720, Color.White); - Vector2 location = new Vector2((float)(this.xPositionOnScreen + Game1.tileSize / 2), (float)(this.yPositionOnScreen + Game1.tileSize / 2)); - // Log.AsyncO(this.currentTab); - for (int index = this.currentTab * 9; index < this.currentTab * 9 + 9; ++index) - { - if (this.categoryItems[this.currentPage].Count > index) - { - this.categoryItems[this.currentPage][index].drawInMenu(b, location, 1f, 1f, 1f, true); - if (LocalizedContentManager.CurrentLanguageLatin) - { - SpriteText.drawString(b, this.categoryItems[this.currentPage][index].DisplayName + (this.categoryItems[this.currentPage][index].Stack > 1 ? " x" + (object)this.categoryItems[this.currentPage][index].Stack : ""), (int)location.X + Game1.tileSize + Game1.pixelZoom * 3, (int)location.Y + Game1.pixelZoom * 3, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); - string s = "."; - int num = 0; - while (true) - { - if (num < this.width - Game1.tileSize * 3 / 2 - SpriteText.getWidthOfString(this.categoryItems[this.currentPage][index].DisplayName + (this.categoryItems[this.currentPage][index].Stack > 1 ? " x" + (object)this.categoryItems[this.currentPage][index].Stack : "") + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((this.categoryItems[this.currentPage][index] as StardewValley.Object).sellToStorePrice() * (this.categoryItems[this.currentPage][index] as StardewValley.Object).Stack)))) - { - s += " ."; - num += SpriteText.getWidthOfString(" ."); - } - else - break; - } - SpriteText.drawString(b, s, (int)location.X + Game1.tileSize * 5 / 4 + SpriteText.getWidthOfString(this.categoryItems[this.currentPage][index].DisplayName + (this.categoryItems[this.currentPage][index].Stack > 1 ? " x" + (object)this.categoryItems[this.currentPage][index].Stack : "")), (int)location.Y + Game1.tileSize / 8, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); - SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((this.categoryItems[this.currentPage][index] as StardewValley.Object).sellToStorePrice() * (this.categoryItems[this.currentPage][index] as StardewValley.Object).Stack)), (int)location.X + this.width - Game1.tileSize - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((this.categoryItems[this.currentPage][index] as StardewValley.Object).sellToStorePrice() * (this.categoryItems[this.currentPage][index] as StardewValley.Object).Stack))), (int)location.Y + Game1.pixelZoom * 3, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); - } - else - { - string s1 = this.categoryItems[this.currentPage][index].DisplayName + (this.categoryItems[this.currentPage][index].Stack > 1 ? " x" + (object)this.categoryItems[this.currentPage][index].Stack : "."); - string s2 = Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((this.categoryItems[this.currentPage][index] as StardewValley.Object).sellToStorePrice() * (this.categoryItems[this.currentPage][index] as StardewValley.Object).Stack)); - int x = (int)location.X + this.width - Game1.tileSize - SpriteText.getWidthOfString(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", (object)((this.categoryItems[this.currentPage][index] as StardewValley.Object).sellToStorePrice() * (this.categoryItems[this.currentPage][index] as StardewValley.Object).Stack))); - SpriteText.getWidthOfString(s1 + s2); - while (SpriteText.getWidthOfString(s1 + s2) < 1155 - Game1.tileSize / 2) - s1 += " ."; - if (SpriteText.getWidthOfString(s1 + s2) >= 1155) - s1 = s1.Remove(s1.Length - 1); - SpriteText.drawString(b, s1, (int)location.X + Game1.tileSize + Game1.pixelZoom * 3, (int)location.Y + Game1.pixelZoom * 3, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); - SpriteText.drawString(b, s2, x, (int)location.Y + Game1.pixelZoom * 3, 999999, -1, 999999, 1f, 0.88f, false, -1, "", -1); - } - location.Y += (float)(Game1.tileSize + Game1.pixelZoom); - } - } - this.backButton.draw(b); - if (this.showForwardButton()) - this.forwardButton.draw(b); - } - if (this.outro) - { - b.Draw(Game1.mouseCursors, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(639, 858, 1, 184)), Color.Black * (float)(1.0 - (double)this.outroFadeTimer / 800.0)); - SpriteText.drawStringWithScrollCenteredAt(b, this.newDayPlaque ? Utility.getDateString(1) : Utility.getDateString(0), Game1.viewport.Width / 2, this.dayPlaqueY, "", 1f, -1, 0, 0.88f, false); - foreach (TemporaryAnimatedSprite animation in this.animations) - animation.draw(b, true, 0, 0); - if (this.finalOutroTimer > 0) - b.Draw(Game1.staminaRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black * (float)(1.0 - (double)this.finalOutroTimer / 2000.0)); - } - if (this.saveGameMenu != null) - this.saveGameMenu.draw(b); - if (Game1.options.SnappyMenus && (this.introTimer > 0 || this.outro)) - return; - this.drawMouse(b); - } - } -} - diff --git a/GeneralMods/AdditionalCropsFramework/ModCore.cs b/GeneralMods/AdditionalCropsFramework/ModCore.cs index 6beb24e1..7682ef44 100644 --- a/GeneralMods/AdditionalCropsFramework/ModCore.cs +++ b/GeneralMods/AdditionalCropsFramework/ModCore.cs @@ -31,14 +31,11 @@ namespace AdditionalCropsFramework { public static IModHelper ModHelper; public static IMonitor ModMonitor; - - - - public static readonly List SpringWildCrops = new List(); public static readonly List SummerWildCrops = new List(); public static readonly List FallWildCrops = new List(); public static readonly List WinterWildCrops = new List(); + public static Framework.Config ModConfig; private List shippingList; @@ -61,35 +58,8 @@ namespace AdditionalCropsFramework StardustCore.ModCore.SerializationManager.acceptedTypes.Add("AdditionalCropsFramework.ModularSeeds", new SerializerDataNode(new SerializerDataNode.SerializingFunction(ModularSeeds.Serialize), new SerializerDataNode.ParsingFunction(ModularSeeds.ParseIntoInventory), new SerializerDataNode.WorldParsingFunction(ModularSeeds.SerializeFromWorld),new SerializerDataNode.SerializingToContainerFunction(ModularSeeds.Serialize))); // StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick; this.shippingList = new List(); - } - //Unused - private void GameEvents_UpdateTick(object sender, EventArgs e) - { - - if (Game1.activeClickableMenu != null) return; - else - { - if (shippingList.Count > 0) Game1.activeClickableMenu = new Menus.ShippingMenuExpanded(shippingList); - shippingList.Clear(); - } - if (Game1.newDay == true) - { - foreach(var v in Game1.getFarm().shippingBin) - { - if (shippingList.Contains(v)) continue; - if (v is StardustCore.CoreObject) - { - //Log.AsyncC(v.Name); - shippingList.Add(v); - } - } - foreach(var v in shippingList) - { - Game1.getFarm().shippingBin.Remove(v); - } - } - + ModConfig= helper.ReadConfig(); } public void dailyUpdates() diff --git a/GeneralMods/AdditionalCropsFramework/PlanterBox.cs b/GeneralMods/AdditionalCropsFramework/PlanterBox.cs index be0e9a25..6f231d90 100644 --- a/GeneralMods/AdditionalCropsFramework/PlanterBox.cs +++ b/GeneralMods/AdditionalCropsFramework/PlanterBox.cs @@ -62,6 +62,8 @@ namespace AdditionalCropsFramework public string normalCropSeedName; public int normalCropSeedIndex; + public bool greenHouseEffect; + public bool selfWatering; public override string Name { @@ -199,14 +201,14 @@ namespace AdditionalCropsFramework // this.thisType = GetType(); this.tileLocation = tile; this.InitializeBasics(0, tile); - TextureSheet = ModCore.ModHelper.Content.Load(Path.Combine(Utilities.EntensionsFolderName, ObjectTexture)); //Game1.content.Load("TileSheets\\furniture"); - texturePath = ObjectTexture; + TextureSheet = ModCore.ModHelper.Content.Load(Path.Combine(Utilities.EntensionsFolderName, ObjectTexture)); //Game1.content.Load("TileSheets\\furniture"); + texturePath = ObjectTexture; Dictionary dictionary; try { - dictionary = ModCore.ModHelper.Content.Load>(Path.Combine(Utilities.EntensionsFolderName, DataPath)); - dataPath = DataPath; + dictionary = ModCore.ModHelper.Content.Load>(Path.Combine(Utilities.EntensionsFolderName, DataPath)); + dataPath = DataPath; string s = ""; @@ -247,6 +249,25 @@ namespace AdditionalCropsFramework this.updateDrawPosition(); this.price = Convert.ToInt32(array[2]); this.parentSheetIndex = which; + + try + { + this.selfWatering = Convert.ToBoolean(array[4]); + } + catch(Exception e) + { + Log.AsyncG(e); + this.selfWatering = false; + } + try + { + this.greenHouseEffect = Convert.ToBoolean(array[5]); + } + catch (Exception e) + { + Log.AsyncG(e); + this.greenHouseEffect = false; + } } catch(Exception e) @@ -396,7 +417,29 @@ namespace AdditionalCropsFramework } } - + if (Game1.player.CurrentItem != null) + { + if (Game1.player.CurrentItem is StardewValley.Tools.MeleeWeapon || Game1.player.CurrentItem is StardewValley.Tools.Sword) + { + if (this.modularCrop != null) + { + if (this.modularCrop.dead == true) + { + this.modularCrop = null; + return false; + } + } + if (this.crop != null) + { + if (this.crop.dead == true) + { + this.crop = null; + return false; + } + } + } + } + if (removable == false) return false; @@ -474,28 +517,76 @@ namespace AdditionalCropsFramework public void dayUpdate() { - + + if (ModCore.ModConfig.removeCropsDayofDying == false) + { + if (this.crop != null) + { + if (this.crop.dead) this.crop = null; + + } + } + + if (this.modularCrop != null) + { + if (this.modularCrop.dead) this.modularCrop = null; + } + + + if (this.selfWatering == true) + { + this.isWatered = true; + this.animationManager.setAnimation("Watered", 0); + } + + if (this.isWatered==true) { if (this.crop != null) { - Utilities.cropNewDay(this.crop,1, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation); + Utilities.cropNewDay(this,this.crop,1, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation); } if (this.modularCrop != null) { - Utilities.cropNewDayModded(this.modularCrop,1, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation); + Utilities.cropNewDayModded(this,this.modularCrop,1, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation); + } + if (this.selfWatering == false) + { + this.isWatered = false; + this.animationManager.setAnimation("Default", 0); } - - this.isWatered = false; - this.animationManager.setAnimation("Default", 0); } - else + else //if planterbox isn't watered { - - this.animationManager.setAnimation("Default", 0); + if (this.crop != null) + { + Utilities.cropNewDay(this, this.crop, 0, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation); + + } + + if (this.modularCrop != null) + { + Utilities.cropNewDayModded(this, this.modularCrop, 0, 0, (int)this.tileLocation.X, (int)this.tileLocation.Y, this.thisLocation); + } + if (this.selfWatering == false) + { + this.isWatered = false; + this.animationManager.setAnimation("Default", 0); + } } + //Update ticks occ + if (ModCore.ModConfig.removeCropsDayofDying == true) + { + if (this.crop != null) + { + if (this.crop.dead) this.crop = null; + + } + } + + } public void resetOnPlayerEntry(GameLocation environment) @@ -985,7 +1076,8 @@ namespace AdditionalCropsFramework d.cropInformationString = obj.cropInformationString; d.serializationName = obj.serializationName; d.IsSolid = obj.IsSolid; - + d.selfWatering = obj.selfWatering; + d.greenHouseEffect = obj.greenHouseEffect; string IsWatered = obj.isWatered; // Log.AsyncC("AM I WATERED OR NOT?!?!?: "+IsWatered); d.isWatered = Convert.ToBoolean(IsWatered); diff --git a/GeneralMods/RuneFactoryCropsMod/RuneFactoryCropsMod/PlanterBox.xnb b/GeneralMods/RuneFactoryCropsMod/RuneFactoryCropsMod/PlanterBox.xnb index 8236dcddad015fcccc3a8dc47c66bb2cf24f6830..d1a90b9bb878182bc4353381179959223112d41b 100644 GIT binary patch literal 1124 zcmV-q1e^O#0L2Rc0RIcc1WW)BQoH~FBLFl+003!Le3HC#5(DLCd%fGb z2-L`;f+Geaz#;>}GIzSk-DPgNa@~M$pniymg!^ZG`}bJ=`m=Dp0DuSp(aZpVgB9Yt ztY=zDS;X)~xEap^zyNRr3P2J;B0`X8+6~^i4pN%dRXbyCI1DMtmVsJIKnuVWClIB8 z|NkJM00000LIMC)>M*GHM>wMLBRjvpiodsO-Ig1ithi%F$#7`fooYqc5?0LDy+vd@ zHpG=yXFHiRGJ`Bu)sAmvix!I9>*^wF8#g*aXy#9h3W3};UgP--Z-++k_T-1e4F~p$ z*HJuXwpG?J%Z^^$Y5)2iPw!f?Y)9(FZPRJ`jjAcypdhfwrb_qS?d9UE4}(W@?f;+k zy(P1M#jK}m=abAnfwH#z`qu8vY`eSjHK?k0)xup~Mprs0H}>{NUo7$h;0-Y(8yuOH zFax+If*x(%I?EsaJQ|cpw4`OxlZnVG2?Y1LoMF-q00b;w=eipnplo}0T1uk5*Y^TL zsM|P`vM^QKL~xG#mn1&zt;DQ$zIUMVs68@lQ1fO#;kFZ7f&dRdE(`1+g*$p(eWdMk z^GA+w^Rai4t&a!&2-w^bxmtSUK_%`pXgE!IqV(F{AbA?%p_050n}agAPYudJ6=31l z{SV}ffpn((pHBB9d`R$UEunH2k|$EqM^ zy9pul^qxUdx6g!1I-I`%-2k&=d5wd(^rPsGc*Z)g>KFsaDuUi9t_hrfXy~Ggm3A$k z-1FxX_Lq+1FFZHK8>Xd_Lx>GK=c&p_d&?El#^GQlEJ z8(D^UFcyh#h>jLYtk)@CIIc_Uq~=pFK&czl8RO_3A+p#;sGCrnpdEP3x8`iGvJoEP z14Tp?Z^Y`+r(re8L&ucGCn;4_c>{D-coddy-2^yNW_g-Mg9UB{36lb5B}z7D73fm|PfrjvQ@$>^XS-+N^v^l+h!tEH&Yn6wadSg}PZ)1Py*`o6JAiyqUH=q{~L zao*E<^5fxcsb`vuY>dW7(pL3whW7Q`2dTMx8S`!9kf-5>;+B_Nrk z#-@I~=VCnWx{2@kZLq0*5RGc=J;8O8vw9HfQ`!R~H`?A*Ghu;v&%usveYtj2#^-rn8r z(B6w8jv$N(ix>z4+YTn3EmKRoxpw+55fQi_>qmV(R(oL>MC0{}%c0B~>yzxPis z7j2MER+e4(26qC#iBJs2i-;puAkuE{x1Fg-x!rfxHL_eu#hE3}=GGX=U?ljZzZv@f z00aO4002rz2B2OY2lf64M^txY_xDZl3a7W@28HrE-xr23D)M&7){$(8;{~DLUbqG; zL!04p3Nf^NU3r$tG`;kGmsh!)IZ`58ZWqJ|5%@tQaG*fpcb*)7zmMd$I6#N2lemcu z%`u9%ENSFZ9Xy!SWDeLKyVCEa<;+pQl0}k&s%RK8S0(#;_Vt18i$bZt_x~)roJ+I+ z#j>)S^GRoalv$T}I~N`u;Seq)m2CR%DxRKjlhLJ zH4~w=H-d5Cz@_$O&@_`)^iO@&QBPu5QJcAc`8HE)iU1E_IwS2M#k+T%`-t2pb+)#- zClJsdk;h7YDrP?_9F!T>eqAs_M{I7AOlSQV zKq>g+{s@>v4UvK#m?>4#UsiZ`!go0V6-$%O6V|0a^E+h4aGc!mm9#HQUS(3nvDK6$ z74d^{9#b?^W6^EDV4sYT35Wecfq1{7fhW*f!Ytu0+W3!-p2QJmo^Q%%ah+_4mbvjX zJP``zdma_3N0rv#Y*dXYltv$H_wT_pLg>qn|B<Y%BWe8JsjRqSpVgJyam;!&8obrji19p~sO$P`s8OIQ+cJ!!N#UYmq|&I+t1Dkqih z7`WpSZ?(`{Y&!hm>By&y9gNM18y?YXGCG{~M{dIWWh+Y`NUQAWrv0rZ-{I&?tuv@^ z){V1Gmeg=P#P^Cu>e*ABXU?h8pfZqjTCq_n)}M2?D!->qO11T5x=Slmpo7d_T=`t1 z^=zi-8@t6BNh^D{WF4dev`Wrau@t!C3xW$Jvu9eb{TE4-Y7v6m6A(<)W7XAO=yk*5 zL=*OGwa=K=4$-OBxQD-fePSCz!;3|&Lw6by=Pogc)&PzM1-DA`v0W9TjGQi gcmfB*mh diff --git a/GeneralMods/StardustCore/Utilities.cs b/GeneralMods/StardustCore/Utilities.cs index 977d33b3..b3b5a3b4 100644 --- a/GeneralMods/StardustCore/Utilities.cs +++ b/GeneralMods/StardustCore/Utilities.cs @@ -6,6 +6,7 @@ using StardewValley.Characters; using StardewValley.Locations; using StardewValley.Objects; using StardewValley.TerrainFeatures; +using StardewValley.Tools; using StardustCore; using System; using System.Collections.Generic; @@ -727,6 +728,108 @@ namespace StardustCore else return false; } + public static void animateOnce(StardewValley.Farmer player,int whichAnimation, float animationInterval, int numberOfFrames, AnimatedSprite.endOfAnimationBehavior endOfBehaviorFunction, bool flip, bool secondaryArm, bool backwards) + { + + if (player.FarmerSprite.PauseForSingleAnimation || player.FarmerSprite.freezeUntilDialogueIsOver) + return; + if (!player.IsMainPlayer) + { + if (whichAnimation <= 240) + { + if (whichAnimation != 232) + { + if (whichAnimation == 240) + { + player.faceDirection(1); + goto label_16; + } + } + else + { + player.faceDirection(2); + goto label_16; + } + } + else if (whichAnimation != 248) + { + if (whichAnimation == 256) + { + player.faceDirection(3); + goto label_16; + } + } + else + { + player.faceDirection(0); + goto label_16; + } + int direction = whichAnimation / 8 % 4; + switch (direction) + { + case 0: + direction = 2; + break; + case 2: + direction = 0; + break; + } + player.faceDirection(direction); + } + label_16: + player.FarmerSprite.setCurrentSingleAnimation(whichAnimation); + player.FarmerSprite.CurrentFrame = player.FarmerSprite.CurrentSingleAnimation; + player.FarmerSprite.PauseForSingleAnimation = true; + player.FarmerSprite.oldFrame = player.FarmerSprite.CurrentFrame; + // player.FarmerSprite.oldInterval = player.FarmerSprite.interval; + player.FarmerSprite.currentSingleAnimationInterval = animationInterval; + // player.FarmerSprite.endOfAnimationFunction = endOfBehaviorFunction; + player.FarmerSprite.timer = 0.0f; + player.FarmerSprite.animatingBackwards = false; + if (backwards) + { + player.FarmerSprite.animatingBackwards = true; + player.FarmerSprite.setCurrentFrameBackwards( player.FarmerSprite.CurrentSingleAnimation, 0, (int)animationInterval, numberOfFrames, secondaryArm, flip); + } + else + player.FarmerSprite.setCurrentFrame( player.FarmerSprite.CurrentSingleAnimation, 0, (int)animationInterval, numberOfFrames, secondaryArm, flip); + if ( player.FarmerSprite.CurrentAnimation[0].frameBehavior != null && ! player.FarmerSprite.CurrentAnimation[0].behaviorAtEndOfFrame) + player.FarmerSprite.CurrentAnimation[0].frameBehavior( player); + if ((double) player.Stamina <= 0.0 && player.usingTool) + { + for (int index = 0; index < player.FarmerSprite.CurrentAnimation.Count; ++index) + player.FarmerSprite.CurrentAnimation[index] = new FarmerSprite.AnimationFrame( player.FarmerSprite.CurrentAnimation[index].frame, player.FarmerSprite.CurrentAnimation[index].milliseconds * 2, player.FarmerSprite.CurrentAnimation[index].secondaryArm, player.FarmerSprite.CurrentAnimation[index].flip, player.FarmerSprite.CurrentAnimation[index].frameBehavior, player.FarmerSprite.CurrentAnimation[index].behaviorAtEndOfFrame); + } + // player.FarmerSprite.CurrentAnimationFrame = player.FarmerSprite.CurrentAnimation.Count; + player.FarmerSprite.indexInCurrentAnimation = 0; + player.FarmerSprite.interval = (float) player.FarmerSprite.CurrentAnimationFrame.milliseconds; + if (Game1.IsClient && player.uniqueMultiplayerID == Game1.player.uniqueMultiplayerID) + { + player.CurrentToolIndex = -1; + if ( player.UsingTool) + { + player.CurrentToolIndex = player.CurrentTool.CurrentParentTileIndex; + if ( player.CurrentTool is FishingRod) + player.CurrentToolIndex = player.facingDirection == 3 || player.facingDirection == 1 ? 55 : 48; + } + MultiplayerUtility.sendAnimationMessageToServer(whichAnimation, numberOfFrames, animationInterval, false, player.CurrentToolIndex); + } + else if (Game1.IsServer) + { + if ( player.IsMainPlayer && player.UsingTool) + { + player.CurrentToolIndex = player.CurrentTool.CurrentParentTileIndex; + if ( player.CurrentTool is FishingRod) + player.CurrentToolIndex = player.facingDirection == 3 || player.facingDirection == 1 ? 55 : 48; + } + MultiplayerUtility.broadcastFarmerAnimation( player.uniqueMultiplayerID, whichAnimation, numberOfFrames, animationInterval, false, player.currentLocation.name, player.CurrentToolIndex); + } + if (!Game1.IsMultiplayer || player.FarmerSprite.getWeaponTypeFromAnimation() != 3) + return; + MeleeWeapon.doSwipe( player.FarmerSprite.getWeaponTypeFromAnimation(), player.position, player.facingDirection, animationInterval, player); + } + + } }