Fixed some issues. Updated for SMAPI changes.

This commit is contained in:
cdaragorn 2018-05-16 22:13:19 -06:00
parent 43b6dfeabf
commit 8e63bbaebf
10 changed files with 34 additions and 23 deletions

View File

@ -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;

View File

@ -117,6 +117,8 @@ namespace UIInfoSuite.Options
private void RemoveModOptionsFromMenu(object sender, EventArgsClickableMenuClosed e)
{
GraphicsEvents.OnPostRenderGuiEvent -= DrawButton;
if (_modOptionsPageButton != null)
_modOptionsPageButton.OnLeftClicked -= OnButtonLeftClicked;
if (Game1.activeClickableMenu is GameMenu)
{

View File

@ -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")]

View File

@ -36,7 +36,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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) &&

View File

@ -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",