Fixed shop harvest prices.

This commit is contained in:
U-Gamer\Cdaragorn 2019-12-28 11:44:31 -07:00
parent ac72bfc0e5
commit a972062f5e
4 changed files with 13 additions and 18 deletions

View File

@ -4,12 +4,6 @@ namespace UIInfoSuite
{ {
class ModConfig class ModConfig
{ {
public string[] KeysForBarrelAndCropTimes { get; set; } = new string[]
{
SButton.LeftShift.ToString()
};
public bool CanRightClickForBarrelAndCropTimes { get; set; } = true;
public int[][] Sprinkler { get; set; } = new int[][] public int[][] Sprinkler { get; set; } = new int[][]
{ {

View File

@ -2,6 +2,10 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
/*
* 1.8.4 Fixed ShowHarvestPrices for SDV 1.4 changes.
* */
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -10,7 +14,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UI Info Suite")] [assembly: AssemblyProduct("UI Info Suite")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +35,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.3.0")] [assembly: AssemblyVersion("1.8.4.0")]
[assembly: AssemblyFileVersion("1.8.3.0")] [assembly: AssemblyFileVersion("1.8.4.0")]

View File

@ -42,7 +42,7 @@ namespace UIInfoSuite.UIElements
// draw shop harvest prices // draw shop harvest prices
if (Game1.activeClickableMenu is ShopMenu menu) if (Game1.activeClickableMenu is ShopMenu menu)
{ {
if (typeof(ShopMenu).GetField("hoveredItem", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) is Item hoverItem) if (menu.hoveredItem is Item hoverItem)
{ {
String text = string.Empty; String text = string.Empty;
bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0; bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0;
@ -66,8 +66,8 @@ namespace UIInfoSuite.UIElements
1); 1);
text = " " + temp.Price; text = " " + temp.Price;
} }
Item heldItem = typeof(ShopMenu).GetField("heldItem", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) as Item; var heldItem = menu.heldItem as Item;
if (heldItem == null) if (heldItem == null)
{ {
int value = 0; int value = 0;
@ -144,12 +144,10 @@ namespace UIInfoSuite.UIElements
text, text,
new Vector2(xPosition, yPosition + 4), new Vector2(xPosition, yPosition + 4),
Color.Black * 0.8f); Color.Black * 0.8f);
String hoverText = _helper.Reflection.GetField<String>(menu, "hoverText").GetValue(); String hoverText = _helper.Reflection.GetField<String>(menu, "hoverText").GetValue();
String hoverTitle = _helper.Reflection.GetField<String>(menu, "boldTitleText").GetValue(); String hoverTitle = _helper.Reflection.GetField<String>(menu, "boldTitleText").GetValue();
Item hoverItem2 = _helper.Reflection.GetField<Item>(menu, "hoveredItem").GetValue();
int currency = _helper.Reflection.GetField<int>(menu, "currency").GetValue(); int currency = _helper.Reflection.GetField<int>(menu, "currency").GetValue();
int hoverPrice = _helper.Reflection.GetField<int>(menu, "hoverPrice").GetValue();
IReflectedMethod getHoveredItemExtraItemIndex = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemIndex"); IReflectedMethod getHoveredItemExtraItemIndex = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemIndex");
IReflectedMethod getHoveredItemExtraItemAmount = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemAmount"); IReflectedMethod getHoveredItemExtraItemAmount = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemAmount");
@ -157,14 +155,14 @@ namespace UIInfoSuite.UIElements
Game1.spriteBatch, Game1.spriteBatch,
hoverText, hoverText,
hoverTitle, hoverTitle,
hoverItem2, hoverItem,
heldItem != null, heldItem != null,
-1, -1,
currency, currency,
getHoveredItemExtraItemIndex.Invoke<int>(new object[0]), getHoveredItemExtraItemIndex.Invoke<int>(new object[0]),
getHoveredItemExtraItemAmount.Invoke<int>(new object[0]), getHoveredItemExtraItemAmount.Invoke<int>(new object[0]),
null, null,
hoverPrice); menu.hoverPrice);
} }
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"Name": "UI Info Suite", "Name": "UI Info Suite",
"Author": "Cdaragorn", "Author": "Cdaragorn",
"Version": "1.8.3", "Version": "1.8.4",
"Description": "Adds a lot of useful information to the user interface. This is based on Demiacle's excellent UIModSuite.", "Description": "Adds a lot of useful information to the user interface. This is based on Demiacle's excellent UIModSuite.",
"UniqueID": "Cdaragorn.UiInfoSuite", "UniqueID": "Cdaragorn.UiInfoSuite",
"EntryDll": "UIInfoSuite.dll", "EntryDll": "UIInfoSuite.dll",