From 96c7010c1b1757217a14b49a563707a972fd6107 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 22 Feb 2017 19:48:25 -0500 Subject: [PATCH] update for Stardew Valley 1.9 (#231) --- src/StardewModdingAPI/Constants.cs | 2 +- src/StardewModdingAPI/Framework/SGame.cs | 24 ++++++++++++------- src/StardewModdingAPI/Program.cs | 6 ++--- .../StardewModdingAPI.data.json | 14 +++++++++++ 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs index 262ba61d..76003b69 100644 --- a/src/StardewModdingAPI/Constants.cs +++ b/src/StardewModdingAPI/Constants.cs @@ -33,7 +33,7 @@ namespace StardewModdingAPI public static ISemanticVersion ApiVersion => new SemanticVersion(1, 8, 0, null); /// The minimum supported version of Stardew Valley. - public const string MinimumGameVersion = "1.2"; + public const string MinimumGameVersion = "1.2.9"; /// The directory path containing Stardew Valley's app data. public static string DataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley"); diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs index f64457f8..56631260 100644 --- a/src/StardewModdingAPI/Framework/SGame.cs +++ b/src/StardewModdingAPI/Framework/SGame.cs @@ -923,7 +923,7 @@ namespace StardewModdingAPI.Framework { SpriteBatch spriteBatch = Game1.spriteBatch; SpriteFont smallFont = Game1.smallFont; - object[] objArray = new object[8]; + object[] objArray = new object[10]; int index1 = 0; string str1; if (!Game1.panMode) @@ -938,20 +938,26 @@ namespace StardewModdingAPI.Framework float cursorTransparency = Game1.mouseCursorTransparency; objArray[index3] = (object)cursorTransparency; int index4 = 3; - string str3 = " wasMouseVisibleThisFrame: "; + string str3 = " mousePosition: "; objArray[index4] = (object)str3; int index5 = 4; - string str4 = Game1.wasMouseVisibleThisFrame.ToString(); - objArray[index5] = (object)str4; + int mouseX = Game1.getMouseX(); + objArray[index5] = (object)mouseX; int index6 = 5; - string newLine = Environment.NewLine; - objArray[index6] = (object)newLine; + string str4 = ","; + objArray[index6] = (object)str4; int index7 = 6; - string str5 = "debugOutput: "; - objArray[index7] = (object)str5; + int mouseY = Game1.getMouseY(); + objArray[index7] = (object)mouseY; int index8 = 7; + string newLine = Environment.NewLine; + objArray[index8] = (object)newLine; + int index9 = 8; + string str5 = "debugOutput: "; + objArray[index9] = (object)str5; + int index10 = 9; string debugOutput = Game1.debugOutput; - objArray[index8] = (object)debugOutput; + objArray[index10] = (object)debugOutput; string text = string.Concat(objArray); Vector2 position = new Vector2((float)this.GraphicsDevice.Viewport.TitleSafeArea.X, (float)this.GraphicsDevice.Viewport.TitleSafeArea.Y); Color red = Color.Red; diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index ea81d182..b8a16e79 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -97,6 +97,7 @@ namespace StardewModdingAPI // initialise logging Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); // for consistent log formatting this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Game1.version} on {Environment.OSVersion}", LogLevel.Info); + Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Game1.version}"; // read settings { @@ -252,11 +253,10 @@ namespace StardewModdingAPI this.GameInstance = new SGame(this.Monitor); this.GameInstance.Exiting += (sender, e) => this.IsGameRunning = false; this.GameInstance.Window.ClientSizeChanged += (sender, e) => GraphicsEvents.InvokeResize(this.Monitor, sender, e); - this.GameInstance.Window.Title = $"Stardew Valley - Version {Game1.version}"; + this.GameInstance.Window.Title = $"Stardew Valley {Game1.version}"; gameProgramType.GetField("gamePtr").SetValue(gameProgramType, this.GameInstance); // configure - Game1.version += $" | SMAPI {Constants.ApiVersion}"; Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef; } @@ -565,7 +565,7 @@ namespace StardewModdingAPI // print result this.Monitor.Log($"Loaded {modsLoaded} mods."); - Console.Title = $"Stardew Modding API Console - Version {Constants.ApiVersion} - Mods Loaded: {modsLoaded}"; + Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Game1.version} with {modsLoaded} mods"; } // ReSharper disable once FunctionNeverReturns diff --git a/src/StardewModdingAPI/StardewModdingAPI.data.json b/src/StardewModdingAPI/StardewModdingAPI.data.json index c4f708dc..a28dc3e8 100644 --- a/src/StardewModdingAPI/StardewModdingAPI.data.json +++ b/src/StardewModdingAPI/StardewModdingAPI.data.json @@ -65,6 +65,13 @@ This file contains advanced metadata for SMAPI. You shouldn't change this file. "UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/518", "Notes": "Crashes with 'Method not found: Void StardewValley.Menus.TextBox.set_Highlighted(Boolean)'." }, + { + "Name": "Chests Anywhere", + "ID": "Pathoschild.ChestsAnywhere", + "UpperVersion": "1.9-beta", + "UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/518", + "Notes": "ID changed in 1.9. Crashes with InvalidOperationException: 'The menu doesn't seem to have a player inventory'." + }, { "Name": "CJB Automation", "ID": "CJBAutomation", @@ -184,6 +191,13 @@ This file contains advanced metadata for SMAPI. You shouldn't change this file. "UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/683", "Notes": "Crashes with 'Method not found: Void StardewModdingAPI.Command.CallCommand(System.String)'." }, + { + "Name": "Teleporter", + "ID": "Teleporter", + "UpperVersion": "1.0.2", + "UpdateUrl": "http://community.playstarbound.com/resources/4374", + "Notes": "Crashes with 'InvalidOperationException: The StardewValley.Menus.MapPage object doesn't have a private 'points' instance field'." + }, { "Name": "Zoryn's Better RNG", "ID": "76b6d1e1-f7ba-4d72-8c32-5a1e6d2716f6",