Early changes for 1.3 beta

This commit is contained in:
cdaragorn 2018-05-05 22:21:18 -06:00
parent a87ccaec1c
commit 628fa38555
17 changed files with 196 additions and 164 deletions

View File

@ -56,7 +56,7 @@ namespace UIInfoSuite.Extensions
public static Rectangle GetHeadShot(this NPC npc) public static Rectangle GetHeadShot(this NPC npc)
{ {
int size; int size;
if (!_npcHeadShotSize.TryGetValue(npc.name, out size)) if (!_npcHeadShotSize.TryGetValue(npc.Name, out size))
size = 4; size = 4;
Rectangle mugShotSourceRect = npc.getMugShotSourceRect(); Rectangle mugShotSourceRect = npc.getMugShotSourceRect();

View File

@ -105,7 +105,7 @@ namespace UIInfoSuite
{ {
try try
{ {
_modDataFileName = Path.Combine(Helper.DirectoryPath, Game1.player.name + "_modData.xml"); _modDataFileName = Path.Combine(Helper.DirectoryPath, Game1.player.Name + "_modData.xml");
} }
catch catch
{ {

View File

@ -120,7 +120,8 @@ namespace UIInfoSuite.Options
{ {
GraphicsEvents.OnPostRenderGuiEvent -= DrawButton; GraphicsEvents.OnPostRenderGuiEvent -= DrawButton;
_modOptionsPageButton.OnLeftClicked -= OnButtonLeftClicked; _modOptionsPageButton.OnLeftClicked -= OnButtonLeftClicked;
List<IClickableMenu> tabPages = _helper.Reflection.GetPrivateField<List<IClickableMenu>>(Game1.activeClickableMenu, "pages").GetValue();
List<IClickableMenu> tabPages = _helper.Reflection.GetField<List<IClickableMenu>>(Game1.activeClickableMenu, "pages").GetValue();
tabPages.Remove(_modOptionsPage); tabPages.Remove(_modOptionsPage);
} }
} }
@ -137,7 +138,7 @@ namespace UIInfoSuite.Options
GraphicsEvents.OnPostRenderGuiEvent -= DrawButton; GraphicsEvents.OnPostRenderGuiEvent -= DrawButton;
GraphicsEvents.OnPostRenderGuiEvent += DrawButton; GraphicsEvents.OnPostRenderGuiEvent += DrawButton;
_modOptionsPageButton.OnLeftClicked += OnButtonLeftClicked; _modOptionsPageButton.OnLeftClicked += OnButtonLeftClicked;
List<IClickableMenu> tabPages = _helper.Reflection.GetPrivateField<List<IClickableMenu>>(Game1.activeClickableMenu, "pages").GetValue(); List<IClickableMenu> tabPages = _helper.Reflection.GetField<List<IClickableMenu>>(Game1.activeClickableMenu, "pages").GetValue();
_modOptionsTabPageNumber = tabPages.Count; _modOptionsTabPageNumber = tabPages.Count;
tabPages.Add(_modOptionsPage); tabPages.Add(_modOptionsPage);

View File

@ -10,7 +10,7 @@ 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 © 2017")] [assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,5 +32,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.6.0.0")] [assembly: AssemblyVersion("1.7.1.0")]
[assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyFileVersion("1.7.1.0")]

View File

@ -19,7 +19,7 @@ namespace UIInfoSuite.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {

View File

@ -3,6 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<DeployModFolderName>$(MSBuildProjectName)</DeployModFolderName> <DeployModFolderName>$(MSBuildProjectName)</DeployModFolderName>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -12,7 +13,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UIInfoSuite</RootNamespace> <RootNamespace>UIInfoSuite</RootNamespace>
<AssemblyName>UIInfoSuite</AssemblyName> <AssemblyName>UIInfoSuite</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
@ -128,7 +129,9 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Analyzer Include="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\analyzers\dotnet\cs\StardewModdingAPI.ModBuildConfig.Analyzer.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild"> <Target Name="AfterBuild">
<PropertyGroup> <PropertyGroup>
@ -139,11 +142,11 @@
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).dll.mdb')" /> <Copy SourceFiles="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).dll.mdb')" />
<Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" /> <Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" />
</Target> </Target>
<Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" /> <Import Project="..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets" Condition="Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.0.0\build\Pathoschild.Stardew.ModBuildConfig.targets'))" /> <Error Condition="!Exists('..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Pathoschild.Stardew.ModBuildConfig.2.1.0-beta-20180428\build\Pathoschild.Stardew.ModBuildConfig.targets'))" />
</Target> </Target>
</Project> </Project>

View File

@ -24,7 +24,7 @@ namespace UIInfoSuite.UIElements
private const int SocialPanelWidth = 190; private const int SocialPanelWidth = 190;
private const int SocialPanelXOffset = 160; private const int SocialPanelXOffset = 160;
private SocialPage _socialPage; private SocialPage _socialPage;
private List<ClickableTextureComponent> _friendNames; private String[] _friendNames;
private readonly IDictionary<String, String> _options; private readonly IDictionary<String, String> _options;
private readonly IModHelper _helper; private readonly IModHelper _helper;
@ -133,9 +133,11 @@ namespace UIInfoSuite.UIElements
if (menu is SocialPage) if (menu is SocialPage)
{ {
_socialPage = menu as SocialPage; _socialPage = menu as SocialPage;
_friendNames = typeof(SocialPage) var npcNames = typeof(SocialPage).GetField("npcNames", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) as Dictionary<String, String>;
.GetField("friendNames", BindingFlags.Instance | BindingFlags.NonPublic) _friendNames = npcNames.Keys.ToArray();
.GetValue(menu) as List<ClickableTextureComponent>; //_friendNames = typeof(SocialPage)
// .GetField("npcNames", BindingFlags.Instance | BindingFlags.NonPublic)
// .GetValue(menu) as List<ClickableTextureComponent>;
break; break;
} }
} }
@ -144,20 +146,20 @@ namespace UIInfoSuite.UIElements
{ {
foreach (var npc in location.characters) foreach (var npc in location.characters)
{ {
if (Game1.player.friendships.ContainsKey(npc.name)) if (Game1.player.friendshipData.ContainsKey(npc.Name))
_townsfolk.Add(npc); _townsfolk.Add(npc);
} }
} }
_checkboxes.Clear(); _checkboxes.Clear();
foreach (var friendName in _friendNames) foreach (var friendName in _friendNames)
{ {
int hashCode = friendName.name.GetHashCode(); int hashCode = friendName.GetHashCode();
OptionsCheckbox checkbox = new OptionsCheckbox("", hashCode); OptionsCheckbox checkbox = new OptionsCheckbox("", hashCode);
_checkboxes.Add(checkbox); _checkboxes.Add(checkbox);
//default to on //default to on
bool optionForThisFriend = true; bool optionForThisFriend = true;
if (!Game1.player.friendships.ContainsKey(friendName.name)) if (!Game1.player.friendshipData.ContainsKey(friendName))
{ {
checkbox.greyedOut = true; checkbox.greyedOut = true;
optionForThisFriend = false; optionForThisFriend = false;
@ -224,7 +226,7 @@ namespace UIInfoSuite.UIElements
{ {
try try
{ {
int hashCode = character.name.GetHashCode(); int hashCode = character.Name.GetHashCode();
bool drawCharacter = _options.SafeGet(hashCode.ToString()).SafeParseBool(); bool drawCharacter = _options.SafeGet(hashCode.ToString()).SafeParseBool();
@ -232,7 +234,7 @@ namespace UIInfoSuite.UIElements
{ {
KeyValuePair<int, int> location; KeyValuePair<int, int> location;
location = new KeyValuePair<int, int>((int)character.Position.X, (int)character.position.Y); location = new KeyValuePair<int, int>((int)character.Position.X, (int)character.position.Y);
String locationName = character.currentLocation?.name ?? character.DefaultMap; String locationName = character.currentLocation?.Name ?? character.DefaultMap;
switch (locationName) switch (locationName)
{ {
@ -318,17 +320,17 @@ namespace UIInfoSuite.UIElements
Color.Gray : Color.White; Color.Gray : Color.White;
ClickableTextureComponent textureComponent = ClickableTextureComponent textureComponent =
new ClickableTextureComponent( new ClickableTextureComponent(
character.name, character.Name,
new Rectangle(x, y, 0, 0), new Rectangle(x, y, 0, 0),
null, null,
character.name, character.Name,
character.sprite.Texture, character.Sprite.Texture,
headShot, headShot,
2.3f); 2.3f);
float headShotScale = 2f; float headShotScale = 2f;
Game1.spriteBatch.Draw( Game1.spriteBatch.Draw(
character.sprite.Texture, character.Sprite.Texture,
new Vector2(x, y), new Vector2(x, y),
new Rectangle?(headShot), new Rectangle?(headShot),
color, color,
@ -354,10 +356,10 @@ namespace UIInfoSuite.UIElements
bool isQuestTarget = false; bool isQuestTarget = false;
switch (quest.questType) switch (quest.questType)
{ {
case 3: isQuestTarget = (quest as ItemDeliveryQuest).target == character.name; break; case 3: isQuestTarget = (quest as ItemDeliveryQuest).target == character.Name; break;
case 4: isQuestTarget = (quest as SlayMonsterQuest).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 7: isQuestTarget = (quest as FishingQuest).target == character.Name; break;
case 10: isQuestTarget = (quest as ResourceCollectionQuest).target == character.name; break; case 10: isQuestTarget = (quest as ResourceCollectionQuest).target == character.Name; break;
} }
if (isQuestTarget) if (isQuestTarget)
@ -461,7 +463,7 @@ namespace UIInfoSuite.UIElements
.GetValue(_socialPage); .GetValue(_socialPage);
int yOffset = 0; int yOffset = 0;
for (int i = slotPosition; i < slotPosition + 5 && i <= _friendNames.Count; ++i) for (int i = slotPosition; i < slotPosition + 5 && i <= _friendNames.Length; ++i)
{ {
OptionsCheckbox checkbox = _checkboxes[i]; OptionsCheckbox checkbox = _checkboxes[i];
checkbox.bounds.X = Game1.activeClickableMenu.xPositionOnScreen - 60; checkbox.bounds.X = Game1.activeClickableMenu.xPositionOnScreen - 60;

View File

@ -51,7 +51,7 @@ namespace UIInfoSuite.UIElements
bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0; bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0;
if (hoverItem is StardewValley.Object && if (hoverItem is StardewValley.Object &&
(hoverItem as StardewValley.Object).type == "Seeds" && (hoverItem as StardewValley.Object).Type == "Seeds" &&
itemHasPriceInfo && itemHasPriceInfo &&
hoverItem.Name != "Mixed Seeds" && hoverItem.Name != "Mixed Seeds" &&
hoverItem.Name != "Winter Seeds") hoverItem.Name != "Winter Seeds")
@ -60,21 +60,21 @@ namespace UIInfoSuite.UIElements
new StardewValley.Object( new StardewValley.Object(
new Debris( new Debris(
new Crop( new Crop(
hoverItem.parentSheetIndex, hoverItem.ParentSheetIndex,
0, 0,
0) 0)
.indexOfHarvest, .indexOfHarvest.Value,
Game1.player.position, Game1.player.position,
Game1.player.position).chunkType, Game1.player.position).chunkType.Value,
1); 1);
text = " " + temp.price; text = " " + temp.Price;
} }
Item heldItem = typeof(ShopMenu).GetField("heldItem", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) as Item; Item heldItem = typeof(ShopMenu).GetField("heldItem", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu) as Item;
if (heldItem == null) if (heldItem == null)
{ {
int value = 0; int value = 0;
switch (hoverItem.parentSheetIndex) switch (hoverItem.ParentSheetIndex)
{ {
case 628: value = 50; break; case 628: value = 50; break;
case 629: value = 80; break; case 629: value = 80; break;
@ -89,7 +89,7 @@ namespace UIInfoSuite.UIElements
text = " " + value; text = " " + value;
if (text != "" && if (text != "" &&
(hoverItem as StardewValley.Object).type == "Seeds") (hoverItem as StardewValley.Object).Type == "Seeds")
{ {
String textToRender = _helper.SafeGetString( String textToRender = _helper.SafeGetString(
LanguageKeys.HarvestPrice); LanguageKeys.HarvestPrice);
@ -148,13 +148,13 @@ namespace UIInfoSuite.UIElements
new Vector2(xPosition, yPosition + 4), new Vector2(xPosition, yPosition + 4),
Color.Black * 0.8f); Color.Black * 0.8f);
String hoverText = _helper.Reflection.GetPrivateField<String>(menu, "hoverText").GetValue(); String hoverText = _helper.Reflection.GetField<String>(menu, "hoverText").GetValue();
String hoverTitle = _helper.Reflection.GetPrivateField<String>(menu, "boldTitleText").GetValue(); String hoverTitle = _helper.Reflection.GetField<String>(menu, "boldTitleText").GetValue();
Item hoverItem2 = _helper.Reflection.GetPrivateField<Item>(menu, "hoveredItem").GetValue(); Item hoverItem2 = _helper.Reflection.GetField<Item>(menu, "hoveredItem").GetValue();
int currency = _helper.Reflection.GetPrivateField<int>(menu, "currency").GetValue(); int currency = _helper.Reflection.GetField<int>(menu, "currency").GetValue();
int hoverPrice = _helper.Reflection.GetPrivateField<int>(menu, "hoverPrice").GetValue(); int hoverPrice = _helper.Reflection.GetField<int>(menu, "hoverPrice").GetValue();
IPrivateMethod getHoveredItemExtraItemIndex = _helper.Reflection.GetPrivateMethod(menu, "getHoveredItemExtraItemIndex"); IReflectedMethod getHoveredItemExtraItemIndex = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemIndex");
IPrivateMethod getHoveredItemExtraItemAmount = _helper.Reflection.GetPrivateMethod(menu, "getHoveredItemExtraItemAmount"); IReflectedMethod getHoveredItemExtraItemAmount = _helper.Reflection.GetMethod(menu, "getHoveredItemExtraItemAmount");
IClickableMenu.drawToolTip( IClickableMenu.drawToolTip(
Game1.spriteBatch, Game1.spriteBatch,

View File

@ -14,7 +14,7 @@ namespace UIInfoSuite.UIElements
{ {
class ShowAccurateHearts : IDisposable class ShowAccurateHearts : IDisposable
{ {
private List<ClickableTextureComponent> _friendNames; private String[] _friendNames;
private SocialPage _socialPage; private SocialPage _socialPage;
private readonly int[][] _numArray = new int[][] private readonly int[][] _numArray = new int[][]
@ -57,14 +57,14 @@ namespace UIInfoSuite.UIElements
.GetValue(_socialPage); .GetValue(_socialPage);
int yOffset = 0; int yOffset = 0;
for (int i = slotPosition; i < slotPosition + 5 && i <= _friendNames.Count; ++i) for (int i = slotPosition; i < slotPosition + 5 && i <= _friendNames.Length; ++i)
{ {
int yPosition = Game1.activeClickableMenu.yPositionOnScreen + 130 + yOffset; int yPosition = Game1.activeClickableMenu.yPositionOnScreen + 130 + yOffset;
yOffset += 112; yOffset += 112;
int[] friendshipValues; Friendship friendshipValues;
if (Game1.player.friendships.TryGetValue(_friendNames[i].name, out friendshipValues)) if (Game1.player.friendshipData.TryGetValue(_friendNames[i], out friendshipValues))
{ {
int friendshipRawValue = friendshipValues[0]; int friendshipRawValue = friendshipValues.Points;
if (friendshipRawValue > 0) if (friendshipRawValue > 0)
{ {
@ -72,7 +72,7 @@ namespace UIInfoSuite.UIElements
int numHearts = friendshipRawValue / 250; int numHearts = friendshipRawValue / 250;
if (friendshipRawValue < 3000 && if (friendshipRawValue < 3000 &&
_friendNames[i].name == Game1.player.spouse || _friendNames[i] == Game1.player.spouse ||
friendshipRawValue < 2500) friendshipRawValue < 2500)
{ {
DrawEachIndividualSquare(numHearts, pointsToNextHeart, yPosition); DrawEachIndividualSquare(numHearts, pointsToNextHeart, yPosition);
@ -115,7 +115,8 @@ namespace UIInfoSuite.UIElements
if (menu is SocialPage) if (menu is SocialPage)
{ {
_socialPage = menu as SocialPage; _socialPage = menu as SocialPage;
_friendNames = typeof(SocialPage).GetField("friendNames", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(_socialPage) as List<ClickableTextureComponent>; var npcNames = typeof(SocialPage).GetField("npcNames", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(_socialPage) as Dictionary<String, String>;
_friendNames = npcNames.Keys.ToArray();
break; break;
} }
} }

View File

@ -33,13 +33,17 @@ namespace UIInfoSuite.UIElements
private void CheckIfGiftHasBeenGiven(object sender, EventArgs e) private void CheckIfGiftHasBeenGiven(object sender, EventArgs e)
{ {
if (_birthdayNPC != null) if (_birthdayNPC != null &&
Game1.player != null &&
Game1.player.friendshipData != null)
{ {
var birthdayNPCDetails = Game1.player.friendships.SafeGet(_birthdayNPC.name); Friendship birthdayNPCDetails = null;
Game1.player.friendshipData.TryGetValue(_birthdayNPC.Name, out birthdayNPCDetails);
//var birthdayNPCDetails = Game1.player.friendshipData.SafeGet(_birthdayNPC.name);
if (birthdayNPCDetails != null) if (birthdayNPCDetails != null)
{ {
if (birthdayNPCDetails[3] == 1) if (birthdayNPCDetails.GiftsToday == 1)
_birthdayNPC = null; _birthdayNPC = null;
} }
} }
@ -71,7 +75,6 @@ namespace UIInfoSuite.UIElements
private void DrawBirthdayIcon(object sender, EventArgs e) private void DrawBirthdayIcon(object sender, EventArgs e)
{ {
var test = Game1.player.friendships;
if (!Game1.eventUp) if (!Game1.eventUp)
{ {
if (_birthdayNPC != null) if (_birthdayNPC != null)
@ -93,15 +96,15 @@ namespace UIInfoSuite.UIElements
ClickableTextureComponent texture = ClickableTextureComponent texture =
new ClickableTextureComponent( new ClickableTextureComponent(
_birthdayNPC.name, _birthdayNPC.Name,
new Rectangle( new Rectangle(
iconPosition.X - 7, iconPosition.X - 7,
iconPosition.Y - 2, iconPosition.Y - 2,
(int)(16.0 * scale), (int)(16.0 * scale),
(int)(16.0 * scale)), (int)(16.0 * scale)),
null, null,
_birthdayNPC.name, _birthdayNPC.Name,
_birthdayNPC.sprite.Texture, _birthdayNPC.Sprite.Texture,
headShot, headShot,
2f); 2f);
@ -109,7 +112,7 @@ namespace UIInfoSuite.UIElements
if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY())) if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{ {
String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.name); String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.Name);
IClickableMenu.drawHoverText( IClickableMenu.drawHoverText(
Game1.spriteBatch, Game1.spriteBatch,
hoverText, hoverText,

View File

@ -55,8 +55,25 @@ namespace UIInfoSuite.UIElements
_currentTileBuilding = null; _currentTileBuilding = null;
} }
_currentTile = Game1.currentLocation.Objects.SafeGet(Game1.currentCursorTile); if (Game1.currentLocation != null)
_terrain = Game1.currentLocation.terrainFeatures.SafeGet(Game1.currentCursorTile); {
if (Game1.currentLocation.Objects == null ||
!Game1.currentLocation.Objects.TryGetValue(Game1.currentCursorTile, out _currentTile))
{
_currentTile = null;
}
if (Game1.currentLocation.terrainFeatures == null ||
!Game1.currentLocation.terrainFeatures.TryGetValue(Game1.currentCursorTile, out _terrain))
{
_terrain = null;
}
}
else
{
_currentTile = null;
_terrain = null;
}
} }
public void Dispose() public void Dispose()
@ -66,55 +83,59 @@ namespace UIInfoSuite.UIElements
private void DrawHoverTooltip(object sender, EventArgs e) private void DrawHoverTooltip(object sender, EventArgs e)
{ {
//StardewValley.Object tile = Game1.currentLocation.Objects.SafeGet(Game1.currentCursorTile);
//TerrainFeature feature = null;
if (_currentTileBuilding != null) if (_currentTileBuilding != null)
{ {
if (_currentTileBuilding is Mill millBuilding) if (_currentTileBuilding is Mill millBuilding)
{ {
if (!millBuilding.input.isEmpty()) if (millBuilding.input.Value != null)
{ {
int wheatCount = 0; if (!millBuilding.input.Value.isEmpty())
int beetCount = 0;
foreach (var item in millBuilding.input.items)
{ {
switch (item.Name) int wheatCount = 0;
int beetCount = 0;
foreach (var item in millBuilding.input.Value.items)
{ {
case "Wheat": wheatCount = item.Stack; break; if (item != null &&
case "Beet": beetCount = item.Stack; break; !String.IsNullOrEmpty(item.Name))
{
switch (item.Name)
{
case "Wheat": wheatCount = item.Stack; break;
case "Beet": beetCount = item.Stack; break;
}
}
} }
}
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
if (wheatCount > 0)
builder.Append(wheatCount + " wheat");
if (beetCount > 0)
{
if (wheatCount > 0) if (wheatCount > 0)
builder.Append(Environment.NewLine); builder.Append(wheatCount + " wheat");
builder.Append(beetCount + " beets");
}
if (builder.Length > 0) if (beetCount > 0)
{ {
IClickableMenu.drawHoverText( if (wheatCount > 0)
Game1.spriteBatch, builder.Append(Environment.NewLine);
builder.ToString(), builder.Append(beetCount + " beets");
Game1.smallFont); }
if (builder.Length > 0)
{
IClickableMenu.drawHoverText(
Game1.spriteBatch,
builder.ToString(),
Game1.smallFont);
}
} }
} }
} }
} }
else if (_currentTile != null && else if (_currentTile != null &&
(!_currentTile.bigCraftable || (!_currentTile.bigCraftable.Value ||
_currentTile.minutesUntilReady > 0)) _currentTile.MinutesUntilReady > 0))
{ {
if (_currentTile.bigCraftable && if (_currentTile.bigCraftable.Value &&
_currentTile.minutesUntilReady > 0 && _currentTile.MinutesUntilReady > 0 &&
_currentTile.Name != "Heater") _currentTile.Name != "Heater")
{ {
StringBuilder hoverText = new StringBuilder(); StringBuilder hoverText = new StringBuilder();
@ -123,18 +144,14 @@ namespace UIInfoSuite.UIElements
{ {
Cask currentCask = _currentTile as Cask; Cask currentCask = _currentTile as Cask;
hoverText.Append((int)(currentCask.daysToMature / currentCask.agingRate)) hoverText.Append((int)(currentCask.daysToMature.Value / currentCask.agingRate.Value))
.Append(" " + _helper.SafeGetString( .Append(" " + _helper.SafeGetString(
LanguageKeys.DaysToMature)); LanguageKeys.DaysToMature));
}
else if (_currentTile is StardewValley.Buildings.Mill)
{
} }
else else
{ {
int hours = _currentTile.minutesUntilReady / 60; int hours = _currentTile.MinutesUntilReady / 60;
int minutes = _currentTile.minutesUntilReady % 60; int minutes = _currentTile.MinutesUntilReady % 60;
if (hours > 0) if (hours > 0)
hoverText.Append(hours).Append(" ") hoverText.Append(hours).Append(" ")
.Append(_helper.SafeGetString( .Append(_helper.SafeGetString(
@ -156,34 +173,34 @@ namespace UIInfoSuite.UIElements
{ {
HoeDirt hoeDirt = _terrain as HoeDirt; HoeDirt hoeDirt = _terrain as HoeDirt;
if (hoeDirt.crop != null && if (hoeDirt.crop != null &&
!hoeDirt.crop.dead) !hoeDirt.crop.dead.Value)
{ {
int num = 0; int num = 0;
if (hoeDirt.crop.fullyGrown && if (hoeDirt.crop.fullyGrown.Value &&
hoeDirt.crop.dayOfCurrentPhase > 0) hoeDirt.crop.dayOfCurrentPhase.Value > 0)
{ {
num = hoeDirt.crop.dayOfCurrentPhase; num = hoeDirt.crop.dayOfCurrentPhase.Value;
} }
else else
{ {
for (int i = 0; i < hoeDirt.crop.phaseDays.Count - 1; ++i) for (int i = 0; i < hoeDirt.crop.phaseDays.Count - 1; ++i)
{ {
if (hoeDirt.crop.currentPhase == i) if (hoeDirt.crop.currentPhase.Value == i)
num -= hoeDirt.crop.dayOfCurrentPhase; num -= hoeDirt.crop.dayOfCurrentPhase.Value;
if (hoeDirt.crop.currentPhase <= i) if (hoeDirt.crop.currentPhase.Value <= i)
num += hoeDirt.crop.phaseDays[i]; num += hoeDirt.crop.phaseDays[i];
} }
} }
if (hoeDirt.crop.indexOfHarvest > 0) if (hoeDirt.crop.indexOfHarvest.Value > 0)
{ {
String hoverText = _indexOfCropNames.SafeGet(hoeDirt.crop.indexOfHarvest); String hoverText = _indexOfCropNames.SafeGet(hoeDirt.crop.indexOfHarvest.Value);
if (String.IsNullOrEmpty(hoverText)) if (String.IsNullOrEmpty(hoverText))
{ {
hoverText = new StardewValley.Object(new Debris(hoeDirt.crop.indexOfHarvest, Vector2.Zero, Vector2.Zero).chunkType, 1).DisplayName; hoverText = new StardewValley.Object(new Debris(hoeDirt.crop.indexOfHarvest.Value, Vector2.Zero, Vector2.Zero).chunkType.Value, 1).DisplayName;
_indexOfCropNames.Add(hoeDirt.crop.indexOfHarvest, hoverText); _indexOfCropNames.Add(hoeDirt.crop.indexOfHarvest.Value, hoverText);
} }
StringBuilder finalHoverText = new StringBuilder(); StringBuilder finalHoverText = new StringBuilder();
@ -210,11 +227,11 @@ namespace UIInfoSuite.UIElements
{ {
FruitTree tree = _terrain as FruitTree; FruitTree tree = _terrain as FruitTree;
if (tree.daysUntilMature > 0) if (tree.daysUntilMature.Value > 0)
{ {
IClickableMenu.drawHoverText( IClickableMenu.drawHoverText(
Game1.spriteBatch, Game1.spriteBatch,
tree.daysUntilMature + " " + tree.daysUntilMature.Value + " " +
_helper.SafeGetString( _helper.SafeGetString(
LanguageKeys.DaysToMature), LanguageKeys.DaysToMature),
Game1.smallFont); Game1.smallFont);

View File

@ -76,7 +76,7 @@ namespace UIInfoSuite.UIElements
foreach (var nextBuilding in buildableLocation.buildings) foreach (var nextBuilding in buildableLocation.buildings)
{ {
if (nextBuilding is JunimoHut nextHut) if (nextBuilding is JunimoHut nextHut)
ParseConfigToHighlightedArea(_junimoHutArray, nextHut.tileX + 1, nextHut.tileY + 1); ParseConfigToHighlightedArea(_junimoHutArray, nextHut.tileX.Value + 1, nextHut.tileY.Value + 1);
} }
} }
} }

View File

@ -155,12 +155,12 @@ namespace UIInfoSuite.UIElements
//bool flag = false; //bool flag = false;
if (_hoverItem is StardewValley.Object && if (_hoverItem is StardewValley.Object &&
(_hoverItem as StardewValley.Object).type == "Seeds" && (_hoverItem as StardewValley.Object).Type == "Seeds" &&
itemPrice > 0 && itemPrice > 0 &&
(_hoverItem.Name != "Mixed Seeds" || (_hoverItem.Name != "Mixed Seeds" ||
_hoverItem.Name != "Winter Seeds")) _hoverItem.Name != "Winter Seeds"))
{ {
StardewValley.Object itemObject = new StardewValley.Object(new Debris(new Crop(_hoverItem.parentSheetIndex, 0, 0).indexOfHarvest, Game1.player.position, Game1.player.position).chunkType, 1); StardewValley.Object itemObject = new StardewValley.Object(new Debris(new Crop(_hoverItem.ParentSheetIndex, 0, 0).indexOfHarvest.Value, Game1.player.position, Game1.player.position).chunkType.Value, 1);
//extra += " " + itemObject.Price; //extra += " " + itemObject.Price;
cropPrice = itemObject.Price; cropPrice = itemObject.Price;
//flag = true; //flag = true;
@ -176,8 +176,9 @@ namespace UIInfoSuite.UIElements
foreach (var requiredBundle in _prunedRequiredBundles) foreach (var requiredBundle in _prunedRequiredBundles)
{ {
if (requiredBundle.Value.Contains(_hoverItem.parentSheetIndex) && if (requiredBundle.Value.Contains(_hoverItem.ParentSheetIndex) &&
!_hoverItem.Name.Contains("arecrow")) !_hoverItem.Name.Contains("arecrow") &&
_hoverItem.Name != "Chest")
{ {
requiredBundleName = requiredBundle.Key; requiredBundleName = requiredBundle.Key;
break; break;
@ -392,16 +393,16 @@ namespace UIInfoSuite.UIElements
{ {
bool flag = hoveredItem != null && bool flag = hoveredItem != null &&
hoveredItem is StardewValley.Object && hoveredItem is StardewValley.Object &&
(hoveredItem as StardewValley.Object).edibility != -300; (hoveredItem as StardewValley.Object).Edibility != -300;
int healAmmountToDisplay = flag ? (hoveredItem as StardewValley.Object).edibility : -1; int healAmmountToDisplay = flag ? (hoveredItem as StardewValley.Object).Edibility : -1;
string[] buffIconsToDisplay = null; string[] buffIconsToDisplay = null;
if (flag) if (flag)
{ {
String objectInfo = Game1.objectInformation[(hoveredItem as StardewValley.Object).ParentSheetIndex]; String objectInfo = Game1.objectInformation[(hoveredItem as StardewValley.Object).ParentSheetIndex];
if (Game1.objectInformation[(hoveredItem as StardewValley.Object).parentSheetIndex].Split('/').Length >= 7) if (Game1.objectInformation[(hoveredItem as StardewValley.Object).ParentSheetIndex].Split('/').Length >= 7)
{ {
buffIconsToDisplay = Game1.objectInformation[(hoveredItem as StardewValley.Object).parentSheetIndex].Split('/')[6].Split('^'); buffIconsToDisplay = Game1.objectInformation[(hoveredItem as StardewValley.Object).ParentSheetIndex].Split('/')[6].Split('^');
} }
} }
@ -472,10 +473,10 @@ namespace UIInfoSuite.UIElements
infoWindowWidth = (int)Math.Max(infoWindowWidth, font.MeasureString("99-99 Damage").X + (15 * Game1.pixelZoom) + (Game1.tileSize / 2)); infoWindowWidth = (int)Math.Max(infoWindowWidth, font.MeasureString("99-99 Damage").X + (15 * Game1.pixelZoom) + (Game1.tileSize / 2));
} }
else if (hoveredItem is StardewValley.Object && else if (hoveredItem is StardewValley.Object &&
(hoveredItem as StardewValley.Object).edibility != -300) (hoveredItem as StardewValley.Object).Edibility != -300)
{ {
StardewValley.Object hoveredObject = hoveredItem as StardewValley.Object; StardewValley.Object hoveredObject = hoveredItem as StardewValley.Object;
healAmountToDisplay = (int)Math.Ceiling(hoveredObject.Edibility * 2.5) + hoveredObject.quality * hoveredObject.Edibility; healAmountToDisplay = (int)Math.Ceiling(hoveredObject.Edibility * 2.5) + hoveredObject.Quality * hoveredObject.Edibility;
extraInfoBackgroundHeight += (Game1.tileSize / 2 + Game1.pixelZoom * 2) * (healAmountToDisplay > 0 ? 2 : 1); extraInfoBackgroundHeight += (Game1.tileSize / 2 + Game1.pixelZoom * 2) * (healAmountToDisplay > 0 ? 2 : 1);
} }
} }
@ -589,7 +590,7 @@ namespace UIInfoSuite.UIElements
Game1.smallFont, Game1.smallFont,
Game1.tileSize * 4 + Game1.tileSize / 4)).Y; Game1.tileSize * 4 + Game1.tileSize / 4)).Y;
if (boots.defenseBonus > 0) if (boots.defenseBonus.Value > 0)
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -603,14 +604,14 @@ namespace UIInfoSuite.UIElements
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, batch,
Game1.content.LoadString("Strings\\UI:ItemHover_DefenseBonus", new object[] { boots.defenseBonus }), Game1.content.LoadString("Strings\\UI:ItemHover_DefenseBonus", new object[] { boots.defenseBonus.Value }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom); yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
} }
if (boots.immunityBonus > 0) if (boots.immunityBonus.Value > 0)
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -623,7 +624,7 @@ namespace UIInfoSuite.UIElements
Game1.pixelZoom); Game1.pixelZoom);
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, batch,
Game1.content.LoadString("Strings\\UI:ItemHover_ImmunityBonus", new object[] { boots.immunityBonus }), Game1.content.LoadString("Strings\\UI:ItemHover_ImmunityBonus", new object[] { boots.immunityBonus.Value }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);
@ -642,7 +643,7 @@ namespace UIInfoSuite.UIElements
Game1.textColor); Game1.textColor);
yPos += (int)font.MeasureString(Game1.parseText(meleeWeapon.Description, Game1.smallFont, Game1.tileSize * 4 + Game1.tileSize / 4)).Y; yPos += (int)font.MeasureString(Game1.parseText(meleeWeapon.Description, Game1.smallFont, Game1.tileSize * 4 + Game1.tileSize / 4)).Y;
if ((meleeWeapon as Tool).indexOfMenuItemView != 47) if ((meleeWeapon as Tool).IndexOfMenuItemView != 47)
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -656,13 +657,13 @@ namespace UIInfoSuite.UIElements
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, batch,
Game1.content.LoadString("Strings\\UI:ItemHover_Damage", new object[] { meleeWeapon.minDamage, meleeWeapon.maxDamage }), Game1.content.LoadString("Strings\\UI:ItemHover_Damage", new object[] { meleeWeapon.minDamage.Value, meleeWeapon.maxDamage.Value }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom); yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
if (meleeWeapon.speed != (meleeWeapon.type == 2 ? -8 : 0)) if (meleeWeapon.speed.Value != (meleeWeapon.type.Value == 2 ? -8 : 0))
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -675,18 +676,18 @@ namespace UIInfoSuite.UIElements
Game1.pixelZoom, Game1.pixelZoom,
false, false,
1); 1);
bool flag = meleeWeapon.type == 2 ? meleeWeapon.speed < -8 : meleeWeapon.speed < 0; bool flag = meleeWeapon.type.Value == 2 ? meleeWeapon.speed.Value < -8 : meleeWeapon.speed.Value < 0;
String speedText = ((meleeWeapon.type == 2 ? meleeWeapon.speed + 8 : meleeWeapon.speed) / 2).ToString(); String speedText = ((meleeWeapon.type.Value == 2 ? meleeWeapon.speed.Value + 8 : meleeWeapon.speed.Value) / 2).ToString();
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, batch,
Game1.content.LoadString("Strings\\UI:ItemHover_Speed", new object[] { (meleeWeapon.speed > 0 ? "+" : "") + speedText }), Game1.content.LoadString("Strings\\UI:ItemHover_Speed", new object[] { (meleeWeapon.speed.Value > 0 ? "+" : "") + speedText }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
flag ? Color.DarkRed : Game1.textColor * 0.9f); flag ? Color.DarkRed : Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom); yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
} }
if (meleeWeapon.addedDefense > 0) if (meleeWeapon.addedDefense.Value > 0)
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -701,14 +702,14 @@ namespace UIInfoSuite.UIElements
1f); 1f);
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, batch,
Game1.content.LoadString("Strings\\UI:ItemHover_DefenseBonus", new object[] { meleeWeapon.addedDefense }), Game1.content.LoadString("Strings\\UI:ItemHover_DefenseBonus", new object[] { meleeWeapon.addedDefense.Value }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom); yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
} }
if (meleeWeapon.critChance / 0.02 >= 2.0) if (meleeWeapon.critChance.Value / 0.02 >= 2.0)
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -722,14 +723,14 @@ namespace UIInfoSuite.UIElements
false, false,
1f); 1f);
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, Game1.content.LoadString("Strings\\UI:ItemHover_CritChanceBonus", new object[] { meleeWeapon.critChance / 0.02 }), batch, Game1.content.LoadString("Strings\\UI:ItemHover_CritChanceBonus", new object[] { meleeWeapon.critChance.Value / 0.02 }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom); yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
} }
if (((double)meleeWeapon.critMultiplier - 3.0) / 0.02 >= 1.0) if (((double)meleeWeapon.critMultiplier.Value - 3.0) / 0.02 >= 1.0)
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -744,14 +745,14 @@ namespace UIInfoSuite.UIElements
1f); 1f);
Utility.drawTextWithShadow( Utility.drawTextWithShadow(
batch, Game1.content.LoadString("Strings\\UI:ItemHover_CritPowerBonus", new object[] { (int)((meleeWeapon.critMultiplier - 3.0) / 0.02) }), batch, Game1.content.LoadString("Strings\\UI:ItemHover_CritPowerBonus", new object[] { (int)((meleeWeapon.critMultiplier.Value - 3.0) / 0.02) }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 11, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 11, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom); yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
} }
if (meleeWeapon.knockback != meleeWeapon.defaultKnockBackForThisType(meleeWeapon.type)) if (meleeWeapon.knockback.Value != meleeWeapon.defaultKnockBackForThisType(meleeWeapon.type.Value))
{ {
Utility.drawWithShadow( Utility.drawWithShadow(
batch, batch,
@ -767,7 +768,7 @@ namespace UIInfoSuite.UIElements
batch, batch,
Game1.content.LoadString( Game1.content.LoadString(
"Strings\\UI:ItemHover_Weight", "Strings\\UI:ItemHover_Weight",
new object[] { meleeWeapon.knockback > meleeWeapon.defaultKnockBackForThisType(meleeWeapon.type) ? "+" : "" + Math.Ceiling(Math.Abs(meleeWeapon.knockback - meleeWeapon.defaultKnockBackForThisType(meleeWeapon.type) * 10.0)) }), new object[] { meleeWeapon.knockback.Value > meleeWeapon.defaultKnockBackForThisType(meleeWeapon.type.Value) ? "+" : "" + Math.Ceiling(Math.Abs(meleeWeapon.knockback.Value - meleeWeapon.defaultKnockBackForThisType(meleeWeapon.type.Value) * 10.0)) }),
font, font,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3), new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f); Game1.textColor * 0.9f);

View File

@ -77,7 +77,7 @@ namespace UIInfoSuite.UIElements
{ {
foreach (var npc in location.characters) foreach (var npc in location.characters)
{ {
if (npc.name == "Gus") if (npc.Name == "Gus")
{ {
_gus = npc; _gus = npc;
break; break;
@ -180,15 +180,15 @@ namespace UIInfoSuite.UIElements
ClickableTextureComponent texture = ClickableTextureComponent texture =
new ClickableTextureComponent( new ClickableTextureComponent(
_gus.name, _gus.Name,
new Rectangle( new Rectangle(
iconLocation.X - 7, iconLocation.X - 7,
iconLocation.Y - 2, iconLocation.Y - 2,
(int)(16.0 * scale), (int)(16.0 * scale),
(int)(16.0 * scale)), (int)(16.0 * scale)),
null, null,
_gus.name, _gus.Name,
_gus.sprite.Texture, _gus.Sprite.Texture,
_gus.GetHeadShot(), _gus.GetHeadShot(),
2f); 2f);

View File

@ -1,9 +1,11 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Netcode;
using StardewModdingAPI; using StardewModdingAPI;
using StardewModdingAPI.Events; using StardewModdingAPI.Events;
using StardewValley; using StardewValley;
using StardewValley.Characters; using StardewValley.Characters;
using StardewValley.Network;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -50,20 +52,21 @@ namespace UIInfoSuite.UIElements
private void DrawAnimalHasProduct(object sender, EventArgs e) private void DrawAnimalHasProduct(object sender, EventArgs e)
{ {
if (!Game1.eventUp && if (!Game1.eventUp &&
Game1.activeClickableMenu == null) Game1.activeClickableMenu == null &&
Game1.currentLocation != null)
{ {
var animalsInCurrentLocation = GetAnimalsInCurrentLocation(); var animalsInCurrentLocation = GetAnimalsInCurrentLocation();
if (animalsInCurrentLocation != null) if (animalsInCurrentLocation != null)
{ {
foreach (var animal in animalsInCurrentLocation) foreach (var animal in animalsInCurrentLocation.Pairs)
{ {
if (!animal.Value.IsEmoting && if (!animal.Value.IsEmoting &&
animal.Value.currentProduce != 430 && animal.Value.currentProduce.Value != 430 &&
animal.Value.currentProduce > 0 && animal.Value.currentProduce.Value > 0 &&
animal.Value.age >= animal.Value.ageWhenMature) animal.Value.age.Value >= animal.Value.ageWhenMature.Value)
{ {
Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(animal.Value); Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(animal.Value);
positionAboveAnimal.Y += (float)(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 300.0 + (double)animal.Value.name.GetHashCode()) * 5.0); positionAboveAnimal.Y += (float)(Math.Sin(Game1.currentGameTime.TotalGameTime.TotalMilliseconds / 300.0 + (double)animal.Value.Name.GetHashCode()) * 5.0);
Game1.spriteBatch.Draw( Game1.spriteBatch.Draw(
Game1.emoteSpriteSheet, Game1.emoteSpriteSheet,
new Vector2(positionAboveAnimal.X + 14f, positionAboveAnimal.Y), new Vector2(positionAboveAnimal.X + 14f, positionAboveAnimal.Y),
@ -74,7 +77,8 @@ namespace UIInfoSuite.UIElements
4f, 4f,
SpriteEffects.None, SpriteEffects.None,
1f); 1f);
Rectangle sourceRectangle = Game1.currentLocation.getSourceRectForObject(animal.Value.currentProduce);
Rectangle sourceRectangle = GameLocation.getSourceRectForObject(animal.Value.currentProduce.Value);
Game1.spriteBatch.Draw( Game1.spriteBatch.Draw(
Game1.objectSpriteSheet, Game1.objectSpriteSheet,
new Vector2(positionAboveAnimal.X + 28f, positionAboveAnimal.Y + 8f), new Vector2(positionAboveAnimal.X + 28f, positionAboveAnimal.Y + 8f),
@ -150,13 +154,13 @@ namespace UIInfoSuite.UIElements
if (animalsInCurrentLocation != null) if (animalsInCurrentLocation != null)
{ {
foreach (var animal in animalsInCurrentLocation) foreach (var animal in animalsInCurrentLocation.Pairs)
{ {
if (!animal.Value.IsEmoting && if (!animal.Value.IsEmoting &&
!animal.Value.wasPet) !animal.Value.wasPet.Value)
{ {
Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(animal.Value); Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(animal.Value);
String animalType = animal.Value.type.ToLower(); String animalType = animal.Value.type.Value.ToLower();
if (animalType.Contains("cow") || if (animalType.Contains("cow") ||
animalType.Contains("sheep") || animalType.Contains("sheep") ||
@ -186,7 +190,7 @@ namespace UIInfoSuite.UIElements
foreach (var character in Game1.currentLocation.characters) foreach (var character in Game1.currentLocation.characters)
{ {
if (character is Pet && if (character is Pet &&
!_helper.Reflection.GetPrivateField<bool>(character, "wasPetToday").GetValue()) !_helper.Reflection.GetField<bool>(character, "wasPetToday").GetValue())
{ {
Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(character); Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(character);
positionAboveAnimal.X += 50f; positionAboveAnimal.X += 50f;
@ -211,9 +215,9 @@ namespace UIInfoSuite.UIElements
Game1.viewport.Height <= Game1.currentLocation.map.DisplayHeight ? animal.position.Y - Game1.viewport.Y - 34 : animal.position.Y + ((Game1.viewport.Height - Game1.currentLocation.map.DisplayHeight) / 2 - 50)); Game1.viewport.Height <= Game1.currentLocation.map.DisplayHeight ? animal.position.Y - Game1.viewport.Y - 34 : animal.position.Y + ((Game1.viewport.Height - Game1.currentLocation.map.DisplayHeight) / 2 - 50));
} }
private Dictionary<long, FarmAnimal> GetAnimalsInCurrentLocation() private NetLongDictionary<FarmAnimal, NetRef<FarmAnimal>> GetAnimalsInCurrentLocation()
{ {
Dictionary<long, FarmAnimal> animals = null; NetLongDictionary<FarmAnimal, NetRef<FarmAnimal>> animals = null;
if (Game1.currentLocation is AnimalHouse) if (Game1.currentLocation is AnimalHouse)
{ {

View File

@ -3,13 +3,13 @@
"Author": "Cdaragorn", "Author": "Cdaragorn",
"Version": { "Version": {
"MajorVersion": 1, "MajorVersion": 1,
"MinorVersion": 6, "MinorVersion": 7,
"PatchVersion": 0, "PatchVersion": 1,
"Build": null "Build": null
}, },
"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",
"MinimumApiVersion" : "2.1", "MinimumApiVersion" : "2.0",
"UpdateKeys": [ "Nexus:1150" ] "UpdateKeys": [ "Nexus:1150" ]
} }

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Pathoschild.Stardew.ModBuildConfig" version="2.0.0" targetFramework="net452" /> <package id="Pathoschild.Stardew.ModBuildConfig" version="2.1.0-beta-20180428" targetFramework="net45" />
</packages> </packages>