Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Mar 14, 2018
2 parents 833d98f + 76445dc commit afb3c49
Show file tree
Hide file tree
Showing 62 changed files with 2,057 additions and 447 deletions.
4 changes: 2 additions & 2 deletions build/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;

[assembly: AssemblyProduct("SMAPI")]
[assembly: AssemblyVersion("2.5.2")]
[assembly: AssemblyFileVersion("2.5.2")]
[assembly: AssemblyVersion("2.5.3")]
[assembly: AssemblyFileVersion("2.5.3")]
4 changes: 4 additions & 0 deletions build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Netcode" Condition="Exists('$(GamePath)\Netcode.dll')">
<HintPath>$(GamePath)\Netcode.dll</HintPath>
<Private Condition="'$(MSBuildProjectName)' != 'StardewModdingAPI.Tests'">False</Private>
</Reference>
<Reference Include="Stardew Valley">
<HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
<Private Condition="'$(MSBuildProjectName)' != 'StardewModdingAPI.Tests'">False</Private>
Expand Down
26 changes: 26 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
# Release notes
## 2.6 alpha
* For players:
* Updated for Stardew Valley 1.3 (multiplayer update); no longer compatible with earlier versions.

* For modders:
* Dropped support for some deprecated APIs.
* Fixed some assets not being editable.

## 2.5.3
* For players:
* Simplified and improved skipped-mod messages.
* Fixed rare crash with some combinations of manifest fields and internal mod data.
* Fixed update checks failing for Nexus Mods due to a change in their API.
* Fixed update checks failing for some older mods with non-standard versions.
* Fixed error when a content pack needs a mod that couldn't be loaded.
* Fixed Linux ["magic number is wrong" errors](https://github.com/mono/mono/issues/6752) by changing default terminal order.
* Updated compatibility list and added update checks for more mods.

* For the [log parser][]:
* Fixed incorrect filtering in some cases.
* Fixed error if mods have duplicate names.
* Fixed parse bugs if a mod has no author name.

* For SMAPI developers:
* Internal changes to support the upcoming Stardew Valley 1.3 update.

## 2.5.2
* For modders:
* Fixed issue where replacing an asset through `asset.AsImage()` or `asset.AsDictionary()` didn't take effect.
Expand Down
7 changes: 6 additions & 1 deletion src/SMAPI.Common/Models/ModSeachModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ internal class ModSearchModel
/// <summary>The namespaced mod keys to search.</summary>
public string[] ModKeys { get; set; }

/// <summary>Whether to allow non-semantic versions, instead of returning an error for those.</summary>
public bool AllowInvalidVersions { get; set; }


/*********
** Public methods
Expand All @@ -24,9 +27,11 @@ public ModSearchModel()

/// <summary>Construct an instance.</summary>
/// <param name="modKeys">The namespaced mod keys to search.</param>
public ModSearchModel(IEnumerable<string> modKeys)
/// <param name="allowInvalidVersions">Whether to allow non-semantic versions, instead of returning an error for those.</param>
public ModSearchModel(IEnumerable<string> modKeys, bool allowInvalidVersions)
{
this.ModKeys = modKeys.ToArray();
this.AllowInvalidVersions = allowInvalidVersions;
}
}
}
5 changes: 4 additions & 1 deletion src/SMAPI.Common/SemanticVersionImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ internal class SemanticVersionImpl
/// <summary>An optional prerelease tag.</summary>
public string Tag { get; }

/// <summary>A regex pattern matching a version within a larger string.</summary>
internal const string UnboundedVersionPattern = @"(?>(?<major>0|[1-9]\d*))\.(?>(?<minor>0|[1-9]\d*))(?>(?:\.(?<patch>0|[1-9]\d*))?)(?:-(?<prerelease>(?>[a-z0-9]+[\-\.]?)+))?";

/// <summary>A regular expression matching a semantic version string.</summary>
/// <remarks>
/// This pattern is derived from the BNF documentation in the <a href="https://github.com/mojombo/semver">semver repo</a>,
Expand All @@ -30,7 +33,7 @@ internal class SemanticVersionImpl
/// - allows hyphens in prerelease tags as synonyms for dots (like "-unofficial-update.3");
/// - doesn't allow '+build' suffixes.
/// </remarks>
internal static readonly Regex Regex = new Regex(@"^(?>(?<major>0|[1-9]\d*))\.(?>(?<minor>0|[1-9]\d*))(?>(?:\.(?<patch>0|[1-9]\d*))?)(?:-(?<prerelease>(?>[a-z0-9]+[\-\.]?)+))?$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.ExplicitCapture);
internal static readonly Regex Regex = new Regex($@"^{SemanticVersionImpl.UnboundedVersionPattern}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.ExplicitCapture);

/*********
** Public methods
Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Installer/unix-launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ else
else
x-terminal-emulator -e "$LAUNCHER"
fi
elif $COMMAND xterm 2>/dev/null; then
xterm -e "$LAUNCHER"
elif $COMMAND xfce4-terminal 2>/dev/null; then
xfce4-terminal -e "$LAUNCHER"
elif $COMMAND gnome-terminal 2>/dev/null; then
gnome-terminal -e "$LAUNCHER"
elif $COMMAND xterm 2>/dev/null; then
xterm -e "$LAUNCHER"
elif $COMMAND konsole 2>/dev/null; then
konsole -e "$LAUNCHER"
elif $COMMAND terminal 2>/dev/null; then
Expand Down
4 changes: 4 additions & 0 deletions src/SMAPI.ModBuildConfig/build/smapi.targets
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>false</Private>
</Reference>
<Reference Include="Netcode" Condition="Exists('$(GamePath)\Netcode.dll')">
<HintPath>$(GamePath)\Netcode.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Stardew Valley">
<HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
<Private>false</Private>
Expand Down
5 changes: 4 additions & 1 deletion src/SMAPI.ModBuildConfig/package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Pathoschild.Stardew.ModBuildConfig</id>
<version>2.0.2</version>
<version>2.0.3-alpha20180307</version>
<title>Build package for SMAPI mods</title>
<authors>Pathoschild</authors>
<owners>Pathoschild</owners>
Expand All @@ -26,6 +26,9 @@

2.0.2:
- Fixed compatibility issue on Linux.

2.0.3:
- Added support for Stardew Valley 1.3.
</releaseNotes>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public override void Handle(IMonitor monitor, string command, ArgumentParser arg

// apply quality
if (match.Item is Object obj)
#if STARDEW_VALLEY_1_3
obj.Quality = quality;
#else
obj.quality = quality;
#endif
else if (match.Item is Tool tool)
tool.UpgradeLevel = quality;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using StardewValley;

namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Player
Expand Down Expand Up @@ -36,7 +36,11 @@ public override void Handle(IMonitor monitor, string command, ArgumentParser arg
switch (target)
{
case "hair":
#if STARDEW_VALLEY_1_3
Game1.player.hairstyleColor.Value = color;
#else
Game1.player.hairstyleColor = color;
#endif
monitor.Log("OK, your hair color is updated.", LogLevel.Info);
break;

Expand All @@ -46,7 +50,11 @@ public override void Handle(IMonitor monitor, string command, ArgumentParser arg
break;

case "pants":
#if STARDEW_VALLEY_1_3
Game1.player.pantsColor.Value = color;
#else
Game1.player.pantsColor = color;
#endif
monitor.Log("OK, your pants color is updated.", LogLevel.Info);
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using StardewValley;
using StardewValley;

namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Player
{
Expand Down Expand Up @@ -39,7 +39,11 @@ public override void Handle(IMonitor monitor, string command, ArgumentParser arg
case "farm":
if (!string.IsNullOrWhiteSpace(name))
{
#if STARDEW_VALLEY_1_3
Game1.player.farmName.Value = args[1];
#else
Game1.player.farmName = args[1];
#endif
monitor.Log($"OK, your farm's name is now {Game1.player.farmName}.", LogLevel.Info);
}
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using StardewValley;
using StardewValley;
using StardewValley.Locations;

namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
Expand All @@ -21,7 +21,11 @@ public override void Handle(IMonitor monitor, string command, ArgumentParser arg
{
int level = (Game1.currentLocation as MineShaft)?.mineLevel ?? 0;
monitor.Log($"OK, warping you to mine level {level + 1}.", LogLevel.Info);
#if STARDEW_VALLEY_1_3
Game1.enterMine(level + 1);
#else
Game1.enterMine(false, level + 1, "");
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using StardewValley;

namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
Expand Down Expand Up @@ -26,7 +26,11 @@ public override void Handle(IMonitor monitor, string command, ArgumentParser arg
// handle
level = Math.Max(1, level);
monitor.Log($"OK, warping you to mine level {level}.", LogLevel.Info);
#if STARDEW_VALLEY_1_3
Game1.enterMine(level);
#else
Game1.enterMine(true, level, "");
#endif
}
}
}
83 changes: 74 additions & 9 deletions src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData;
using StardewValley;
Expand Down Expand Up @@ -95,39 +95,90 @@ public IEnumerable<SearchableItem> GetAll()
// fruit products
if (item.category == SObject.FruitsCategory)
{
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset + id, new SObject(348, 1)
// wine
#if STARDEW_VALLEY_1_3
SObject wine =
new SObject(348, 1)
{
Name = $"{item.Name} Wine",
Price = item.price * 3
};
wine.preserve.Value = SObject.PreserveType.Wine;
wine.preservedParentSheetIndex.Value = item.parentSheetIndex;
#else
SObject wine = new SObject(348, 1)
{
name = $"{item.Name} Wine",
price = item.price * 3,
preserve = SObject.PreserveType.Wine,
preservedParentSheetIndex = item.parentSheetIndex
});
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 2 + id, new SObject(344, 1)
};
#endif
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset + id, wine);

// jelly
#if STARDEW_VALLEY_1_3
SObject jelly = new SObject(344, 1)
{
Name = $"{item.Name} Jelly",
Price = 50 + item.Price * 2
};
jelly.preserve.Value = SObject.PreserveType.Jelly;
jelly.preservedParentSheetIndex.Value = item.parentSheetIndex;
#else
SObject jelly = new SObject(344, 1)
{
name = $"{item.Name} Jelly",
price = 50 + item.Price * 2,
preserve = SObject.PreserveType.Jelly,
preservedParentSheetIndex = item.parentSheetIndex
});
};
#endif
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 2 + id, jelly);
}

// vegetable products
else if (item.category == SObject.VegetableCategory)
{
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 3 + id, new SObject(350, 1)
// juice
#if STARDEW_VALLEY_1_3
SObject juice = new SObject(350, 1)
{
Name = $"{item.Name} Juice",
Price = (int)(item.price * 2.25d)
};
juice.preserve.Value = SObject.PreserveType.Juice;
juice.preservedParentSheetIndex.Value = item.parentSheetIndex;
#else
SObject juice = new SObject(350, 1)
{
name = $"{item.Name} Juice",
price = (int)(item.price * 2.25d),
preserve = SObject.PreserveType.Juice,
preservedParentSheetIndex = item.parentSheetIndex
});
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 4 + id, new SObject(342, 1)
};
#endif
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 3 + id, juice);

// pickled
#if STARDEW_VALLEY_1_3
SObject pickled = new SObject(342, 1)
{
Name = $"Pickled {item.Name}",
Price = 50 + item.Price * 2
};
pickled.preserve.Value = SObject.PreserveType.Pickle;
pickled.preservedParentSheetIndex.Value = item.parentSheetIndex;
#else
SObject pickled = new SObject(342, 1)
{
name = $"Pickled {item.Name}",
price = 50 + item.Price * 2,
preserve = SObject.PreserveType.Pickle,
preservedParentSheetIndex = item.parentSheetIndex
});
};
#endif
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 4 + id, pickled);
}

// flower honey
Expand Down Expand Up @@ -160,6 +211,19 @@ public IEnumerable<SearchableItem> GetAll()
// yield honey
if (type != null)
{
#if STARDEW_VALLEY_1_3
SObject honey = new SObject(Vector2.Zero, 340, item.Name + " Honey", false, true, false, false)
{
Name = "Wild Honey"
};
honey.honeyType.Value = type;

if (type != SObject.HoneyType.Wild)
{
honey.Name = $"{item.Name} Honey";
honey.Price += item.Price * 2;
}
#else
SObject honey = new SObject(Vector2.Zero, 340, item.Name + " Honey", false, true, false, false)
{
name = "Wild Honey",
Expand All @@ -170,6 +234,7 @@ public IEnumerable<SearchableItem> GetAll()
honey.name = $"{item.Name} Honey";
honey.price += item.price * 2;
}
#endif
yield return new SearchableItem(ItemType.Object, this.CustomIDOffset * 5 + id, honey);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "2.5.2",
"Version": "2.5.3",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll"
Expand Down
Loading

0 comments on commit afb3c49

Please sign in to comment.