diff --git a/SDVModTest/Extensions/StringExtensions.cs b/SDVModTest/Extensions/StringExtensions.cs index 4a215d1..a279f98 100644 --- a/SDVModTest/Extensions/StringExtensions.cs +++ b/SDVModTest/Extensions/StringExtensions.cs @@ -22,6 +22,16 @@ namespace UIInfoSuite.Extensions return result; } + public static Int64 SafeParseInt64(this String s) + { + Int64 result = 0; + + if (!String.IsNullOrWhiteSpace(s)) + Int64.TryParse(s, out result); + + return result; + } + public static bool SafeParseBool(this String s) { bool result = false; diff --git a/SDVModTest/Options/ModOptionsPageHandler.cs b/SDVModTest/Options/ModOptionsPageHandler.cs index 700ec6f..009f42e 100644 --- a/SDVModTest/Options/ModOptionsPageHandler.cs +++ b/SDVModTest/Options/ModOptionsPageHandler.cs @@ -117,7 +117,9 @@ namespace UIInfoSuite.Options private void RemoveModOptionsFromMenu(object sender, EventArgsClickableMenuClosed e) { GraphicsEvents.OnPostRenderGuiEvent -= DrawButton; - _modOptionsPageButton.OnLeftClicked -= OnButtonLeftClicked; + + if (_modOptionsPageButton != null) + _modOptionsPageButton.OnLeftClicked -= OnButtonLeftClicked; if (Game1.activeClickableMenu is GameMenu) { List tabPages = _helper.Reflection.GetField>(Game1.activeClickableMenu, "pages").GetValue(); diff --git a/SDVModTest/Properties/AssemblyInfo.cs b/SDVModTest/Properties/AssemblyInfo.cs index e9c0db9..0131e6a 100644 --- a/SDVModTest/Properties/AssemblyInfo.cs +++ b/SDVModTest/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.2.0")] -[assembly: AssemblyFileVersion("1.7.2.0")] +[assembly: AssemblyVersion("1.7.5.0")] +[assembly: AssemblyFileVersion("1.7.5.0")] diff --git a/SDVModTest/UI Info Suite.csproj b/SDVModTest/UI Info Suite.csproj index bd36781..8065e8e 100644 --- a/SDVModTest/UI Info Suite.csproj +++ b/SDVModTest/UI Info Suite.csproj @@ -36,7 +36,6 @@ 4 - diff --git a/SDVModTest/UIElements/ExperienceBar.cs b/SDVModTest/UIElements/ExperienceBar.cs index 1d85ade..f7982eb 100644 --- a/SDVModTest/UIElements/ExperienceBar.cs +++ b/SDVModTest/UIElements/ExperienceBar.cs @@ -179,14 +179,14 @@ namespace UIInfoSuite.UIElements _experienceFillColor = new Color(17, 84, 252, 0.63f); _currentLevelIndex = 1; rectangle1.X = 20; - experienceLevel = Game1.player.fishingLevel; + experienceLevel = Game1.player.fishingLevel.Value; } else if (currentItem is Pickaxe) { _experienceFillColor = new Color(145, 104, 63, 0.63f); _currentLevelIndex = 3; rectangle1.X = 30; - experienceLevel = Game1.player.miningLevel; + experienceLevel = Game1.player.miningLevel.Value; } else if (currentItem is MeleeWeapon && currentItem.Name != "Scythe") @@ -194,7 +194,7 @@ namespace UIInfoSuite.UIElements _experienceFillColor = new Color(204, 0, 3, 0.63f); _currentLevelIndex = 4; rectangle1.X = 120; - experienceLevel = Game1.player.combatLevel; + experienceLevel = Game1.player.combatLevel.Value; } else if (Game1.currentLocation is Farm && !(currentItem is Axe)) @@ -202,14 +202,14 @@ namespace UIInfoSuite.UIElements _experienceFillColor = new Color(255, 251, 35, 0.38f); _currentLevelIndex = 0; rectangle1.X = 10; - experienceLevel = Game1.player.farmingLevel; + experienceLevel = Game1.player.farmingLevel.Value; } else { _experienceFillColor = new Color(0, 234, 0, 0.63f); _currentLevelIndex = 2; rectangle1.X = 60; - experienceLevel = Game1.player.foragingLevel; + experienceLevel = Game1.player.foragingLevel.Value; } if (experienceLevel <= 9) diff --git a/SDVModTest/UIElements/LocationOfTownsfolk.cs b/SDVModTest/UIElements/LocationOfTownsfolk.cs index 8cca81b..bcac50f 100644 --- a/SDVModTest/UIElements/LocationOfTownsfolk.cs +++ b/SDVModTest/UIElements/LocationOfTownsfolk.cs @@ -349,15 +349,15 @@ namespace UIInfoSuite.UIElements foreach (var quest in Game1.player.questLog) { - if (quest.accepted && quest.dailyQuest && !quest.completed) + if (quest.accepted.Value && quest.dailyQuest.Value && !quest.completed.Value) { bool isQuestTarget = false; - switch (quest.questType) + switch (quest.questType.Value) { - case 3: isQuestTarget = (quest as ItemDeliveryQuest).target == character.Name; break; - case 4: isQuestTarget = (quest as SlayMonsterQuest).target == character.Name; break; - case 7: isQuestTarget = (quest as FishingQuest).target == character.Name; break; - case 10: isQuestTarget = (quest as ResourceCollectionQuest).target == character.Name; break; + case 3: isQuestTarget = (quest as ItemDeliveryQuest).target.Value == character.Name; break; + case 4: isQuestTarget = (quest as SlayMonsterQuest).target.Value == character.Name; break; + case 7: isQuestTarget = (quest as FishingQuest).target.Value == character.Name; break; + case 10: isQuestTarget = (quest as ResourceCollectionQuest).target.Value == character.Name; break; } if (isQuestTarget) @@ -461,7 +461,7 @@ namespace UIInfoSuite.UIElements .GetValue(_socialPage); int yOffset = 0; - for (int i = slotPosition; i < slotPosition + 5 && i <= _friendNames.Length; ++i) + for (int i = slotPosition; i < slotPosition + 5 && i < _friendNames.Length; ++i) { OptionsCheckbox checkbox = _checkboxes[i]; checkbox.bounds.X = Game1.activeClickableMenu.xPositionOnScreen - 60; diff --git a/SDVModTest/UIElements/ShowAccurateHearts.cs b/SDVModTest/UIElements/ShowAccurateHearts.cs index 51535db..2250b3e 100644 --- a/SDVModTest/UIElements/ShowAccurateHearts.cs +++ b/SDVModTest/UIElements/ShowAccurateHearts.cs @@ -57,7 +57,7 @@ namespace UIInfoSuite.UIElements .GetValue(_socialPage); int yOffset = 0; - for (int i = slotPosition; i < slotPosition + 5 && i <= _friendNames.Length; ++i) + for (int i = slotPosition; i < slotPosition + 5 && i < _friendNames.Length; ++i) { int yPosition = Game1.activeClickableMenu.yPositionOnScreen + 130 + yOffset; yOffset += 112; diff --git a/SDVModTest/UIElements/ShowBirthdayIcon.cs b/SDVModTest/UIElements/ShowBirthdayIcon.cs index 6d40acb..0e8ed7f 100644 --- a/SDVModTest/UIElements/ShowBirthdayIcon.cs +++ b/SDVModTest/UIElements/ShowBirthdayIcon.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Netcode; namespace UIInfoSuite.UIElements { @@ -37,10 +38,9 @@ namespace UIInfoSuite.UIElements Game1.player != null && Game1.player.friendshipData != null) { - Friendship birthdayNPCDetails = null; - Game1.player.friendshipData.TryGetValue(_birthdayNPC.Name, out birthdayNPCDetails); + Game1.player.friendshipData.FieldDict.TryGetValue(_birthdayNPC.Name, out var netRef); //var birthdayNPCDetails = Game1.player.friendshipData.SafeGet(_birthdayNPC.name); - + Friendship birthdayNPCDetails = netRef; if (birthdayNPCDetails != null) { if (birthdayNPCDetails.GiftsToday == 1) diff --git a/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs b/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs index 17a3ea7..a8f6967 100644 --- a/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs +++ b/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs @@ -213,13 +213,13 @@ namespace UIInfoSuite.UIElements private void CheckForNewRecipe(object sender, EventArgs e) { TV tv = new TV(); - int numRecipesKnown = Game1.player.cookingRecipes.Count; + int numRecipesKnown = Game1.player.cookingRecipes.Count(); String[] recipes = typeof(TV).GetMethod("getWeeklyRecipe", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(tv, null) as String[]; //String[] recipe = GetTodaysRecipe(); //_todaysRecipe = recipe[1]; _todaysRecipe = _recipesByDescription.SafeGet(recipes[0]); - if (Game1.player.cookingRecipes.Count > numRecipesKnown) + if (Game1.player.cookingRecipes.Count() > numRecipesKnown) Game1.player.cookingRecipes.Remove(_todaysRecipe); _drawQueenOfSauceIcon = (Game1.dayOfMonth % 7 == 0 || (Game1.dayOfMonth - 3) % 7 == 0) && diff --git a/SDVModTest/manifest.json b/SDVModTest/manifest.json index 8a00455..15be3fd 100644 --- a/SDVModTest/manifest.json +++ b/SDVModTest/manifest.json @@ -1,7 +1,7 @@ { "Name": "UI Info Suite", "Author": "Cdaragorn", - "Version": "1.7.2", + "Version": "1.7.5", "Description": "Adds a lot of useful information to the user interface. This is based on Demiacle's excellent UIModSuite.", "UniqueID": "Cdaragorn.UiInfoSuite", "EntryDll": "UIInfoSuite.dll",