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)
{
int size;
if (!_npcHeadShotSize.TryGetValue(npc.name, out size))
if (!_npcHeadShotSize.TryGetValue(npc.Name, out size))
size = 4;
Rectangle mugShotSourceRect = npc.getMugShotSourceRect();

View File

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

View File

@ -120,7 +120,8 @@ namespace UIInfoSuite.Options
{
GraphicsEvents.OnPostRenderGuiEvent -= DrawButton;
_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);
}
}
@ -137,8 +138,8 @@ namespace UIInfoSuite.Options
GraphicsEvents.OnPostRenderGuiEvent -= DrawButton;
GraphicsEvents.OnPostRenderGuiEvent += DrawButton;
_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;
tabPages.Add(_modOptionsPage);
}

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UI Info Suite")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
[assembly: AssemblyVersion("1.7.1.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.
// To add or remove a member, edit your .ResX file then rerun ResGen
// 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.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {

View File

@ -3,6 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<DeployModFolderName>$(MSBuildProjectName)</DeployModFolderName>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -12,7 +13,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UIInfoSuite</RootNamespace>
<AssemblyName>UIInfoSuite</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
@ -128,7 +129,9 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</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" />
<Target Name="AfterBuild">
<PropertyGroup>
@ -139,11 +142,11 @@
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll.mdb" DestinationFolder="$(ModPath)" Condition="Exists('$(TargetDir)\$(TargetName).dll.mdb')" />
<Copy SourceFiles="$(ProjectDir)manifest.json" DestinationFolder="$(ModPath)" />
</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">
<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>
</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>
</Project>

View File

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

View File

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

View File

@ -14,7 +14,7 @@ namespace UIInfoSuite.UIElements
{
class ShowAccurateHearts : IDisposable
{
private List<ClickableTextureComponent> _friendNames;
private String[] _friendNames;
private SocialPage _socialPage;
private readonly int[][] _numArray = new int[][]
@ -57,14 +57,14 @@ namespace UIInfoSuite.UIElements
.GetValue(_socialPage);
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;
yOffset += 112;
int[] friendshipValues;
if (Game1.player.friendships.TryGetValue(_friendNames[i].name, out friendshipValues))
Friendship friendshipValues;
if (Game1.player.friendshipData.TryGetValue(_friendNames[i], out friendshipValues))
{
int friendshipRawValue = friendshipValues[0];
int friendshipRawValue = friendshipValues.Points;
if (friendshipRawValue > 0)
{
@ -72,7 +72,7 @@ namespace UIInfoSuite.UIElements
int numHearts = friendshipRawValue / 250;
if (friendshipRawValue < 3000 &&
_friendNames[i].name == Game1.player.spouse ||
_friendNames[i] == Game1.player.spouse ||
friendshipRawValue < 2500)
{
DrawEachIndividualSquare(numHearts, pointsToNextHeart, yPosition);
@ -115,7 +115,8 @@ namespace UIInfoSuite.UIElements
if (menu is 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;
}
}

View File

@ -33,13 +33,17 @@ namespace UIInfoSuite.UIElements
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[3] == 1)
if (birthdayNPCDetails.GiftsToday == 1)
_birthdayNPC = null;
}
}
@ -71,7 +75,6 @@ namespace UIInfoSuite.UIElements
private void DrawBirthdayIcon(object sender, EventArgs e)
{
var test = Game1.player.friendships;
if (!Game1.eventUp)
{
if (_birthdayNPC != null)
@ -93,15 +96,15 @@ namespace UIInfoSuite.UIElements
ClickableTextureComponent texture =
new ClickableTextureComponent(
_birthdayNPC.name,
_birthdayNPC.Name,
new Rectangle(
iconPosition.X - 7,
iconPosition.Y - 2,
(int)(16.0 * scale),
(int)(16.0 * scale)),
null,
_birthdayNPC.name,
_birthdayNPC.sprite.Texture,
_birthdayNPC.Name,
_birthdayNPC.Sprite.Texture,
headShot,
2f);
@ -109,7 +112,7 @@ namespace UIInfoSuite.UIElements
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(
Game1.spriteBatch,
hoverText,

View File

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

View File

@ -76,7 +76,7 @@ namespace UIInfoSuite.UIElements
foreach (var nextBuilding in buildableLocation.buildings)
{
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;
if (_hoverItem is StardewValley.Object &&
(_hoverItem as StardewValley.Object).type == "Seeds" &&
(_hoverItem as StardewValley.Object).Type == "Seeds" &&
itemPrice > 0 &&
(_hoverItem.Name != "Mixed 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;
cropPrice = itemObject.Price;
//flag = true;
@ -176,8 +176,9 @@ namespace UIInfoSuite.UIElements
foreach (var requiredBundle in _prunedRequiredBundles)
{
if (requiredBundle.Value.Contains(_hoverItem.parentSheetIndex) &&
!_hoverItem.Name.Contains("arecrow"))
if (requiredBundle.Value.Contains(_hoverItem.ParentSheetIndex) &&
!_hoverItem.Name.Contains("arecrow") &&
_hoverItem.Name != "Chest")
{
requiredBundleName = requiredBundle.Key;
break;
@ -392,16 +393,16 @@ namespace UIInfoSuite.UIElements
{
bool flag = hoveredItem != null &&
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;
if (flag)
{
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));
}
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;
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);
}
}
@ -589,7 +590,7 @@ namespace UIInfoSuite.UIElements
Game1.smallFont,
Game1.tileSize * 4 + Game1.tileSize / 4)).Y;
if (boots.defenseBonus > 0)
if (boots.defenseBonus.Value > 0)
{
Utility.drawWithShadow(
batch,
@ -603,14 +604,14 @@ namespace UIInfoSuite.UIElements
Utility.drawTextWithShadow(
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
}
if (boots.immunityBonus > 0)
if (boots.immunityBonus.Value > 0)
{
Utility.drawWithShadow(
batch,
@ -623,7 +624,7 @@ namespace UIInfoSuite.UIElements
Game1.pixelZoom);
Utility.drawTextWithShadow(
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);
@ -642,7 +643,7 @@ namespace UIInfoSuite.UIElements
Game1.textColor);
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(
batch,
@ -656,13 +657,13 @@ namespace UIInfoSuite.UIElements
Utility.drawTextWithShadow(
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);
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(
batch,
@ -675,18 +676,18 @@ namespace UIInfoSuite.UIElements
Game1.pixelZoom,
false,
1);
bool flag = meleeWeapon.type == 2 ? meleeWeapon.speed < -8 : meleeWeapon.speed < 0;
String speedText = ((meleeWeapon.type == 2 ? meleeWeapon.speed + 8 : meleeWeapon.speed) / 2).ToString();
bool flag = meleeWeapon.type.Value == 2 ? meleeWeapon.speed.Value < -8 : meleeWeapon.speed.Value < 0;
String speedText = ((meleeWeapon.type.Value == 2 ? meleeWeapon.speed.Value + 8 : meleeWeapon.speed.Value) / 2).ToString();
Utility.drawTextWithShadow(
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
flag ? Color.DarkRed : Game1.textColor * 0.9f);
yPos += (int)Math.Max(font.MeasureString("TT").Y, 12 * Game1.pixelZoom);
}
if (meleeWeapon.addedDefense > 0)
if (meleeWeapon.addedDefense.Value > 0)
{
Utility.drawWithShadow(
batch,
@ -701,14 +702,14 @@ namespace UIInfoSuite.UIElements
1f);
Utility.drawTextWithShadow(
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);
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(
batch,
@ -722,14 +723,14 @@ namespace UIInfoSuite.UIElements
false,
1f);
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);
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(
batch,
@ -744,14 +745,14 @@ namespace UIInfoSuite.UIElements
1f);
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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 11, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);
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(
batch,
@ -767,7 +768,7 @@ namespace UIInfoSuite.UIElements
batch,
Game1.content.LoadString(
"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,
new Vector2(xPos + Game1.tileSize / 4 + Game1.pixelZoom * 13, yPos + Game1.tileSize / 4 + Game1.pixelZoom * 3),
Game1.textColor * 0.9f);

View File

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

View File

@ -1,9 +1,11 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Netcode;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Characters;
using StardewValley.Network;
using System;
using System.Collections.Generic;
using System.Linq;
@ -50,20 +52,21 @@ namespace UIInfoSuite.UIElements
private void DrawAnimalHasProduct(object sender, EventArgs e)
{
if (!Game1.eventUp &&
Game1.activeClickableMenu == null)
Game1.activeClickableMenu == null &&
Game1.currentLocation != null)
{
var animalsInCurrentLocation = GetAnimalsInCurrentLocation();
if (animalsInCurrentLocation != null)
{
foreach (var animal in animalsInCurrentLocation)
foreach (var animal in animalsInCurrentLocation.Pairs)
{
if (!animal.Value.IsEmoting &&
animal.Value.currentProduce != 430 &&
animal.Value.currentProduce > 0 &&
animal.Value.age >= animal.Value.ageWhenMature)
animal.Value.currentProduce.Value != 430 &&
animal.Value.currentProduce.Value > 0 &&
animal.Value.age.Value >= animal.Value.ageWhenMature.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.emoteSpriteSheet,
new Vector2(positionAboveAnimal.X + 14f, positionAboveAnimal.Y),
@ -74,7 +77,8 @@ namespace UIInfoSuite.UIElements
4f,
SpriteEffects.None,
1f);
Rectangle sourceRectangle = Game1.currentLocation.getSourceRectForObject(animal.Value.currentProduce);
Rectangle sourceRectangle = GameLocation.getSourceRectForObject(animal.Value.currentProduce.Value);
Game1.spriteBatch.Draw(
Game1.objectSpriteSheet,
new Vector2(positionAboveAnimal.X + 28f, positionAboveAnimal.Y + 8f),
@ -150,13 +154,13 @@ namespace UIInfoSuite.UIElements
if (animalsInCurrentLocation != null)
{
foreach (var animal in animalsInCurrentLocation)
foreach (var animal in animalsInCurrentLocation.Pairs)
{
if (!animal.Value.IsEmoting &&
!animal.Value.wasPet)
!animal.Value.wasPet.Value)
{
Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(animal.Value);
String animalType = animal.Value.type.ToLower();
String animalType = animal.Value.type.Value.ToLower();
if (animalType.Contains("cow") ||
animalType.Contains("sheep") ||
@ -186,7 +190,7 @@ namespace UIInfoSuite.UIElements
foreach (var character in Game1.currentLocation.characters)
{
if (character is Pet &&
!_helper.Reflection.GetPrivateField<bool>(character, "wasPetToday").GetValue())
!_helper.Reflection.GetField<bool>(character, "wasPetToday").GetValue())
{
Vector2 positionAboveAnimal = GetPetPositionAboveAnimal(character);
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));
}
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)
{

View File

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

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<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>