Skip to content

Commit

Permalink
[slothsoft#51] create shipping bin decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
slothsoft committed Nov 10, 2022
1 parent 5d09b59 commit cd9fc63
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 2 deletions.
32 changes: 32 additions & 0 deletions Informant/Implementation/Decorator/ShippingBinDecorator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Microsoft.Xna.Framework.Graphics;
using Slothsoft.Informant.Api;

namespace Slothsoft.Informant.Implementation.Decorator;

internal class ShippingBinDecorator : IDecorator<Item> {

private static Texture2D? _shippingBin;

private readonly IModHelper _modHelper;

public ShippingBinDecorator(IModHelper modHelper) {
_modHelper = modHelper;
_shippingBin ??= modHelper.ModContent.Load<Texture2D>("assets/shipping_bin.png");
}

public string Id => "shipping";
public string DisplayName => _modHelper.Translation.Get("ShippingBinDecorator");
public string Description => _modHelper.Translation.Get("ShippingBinDecorator.Description");

public bool HasDecoration(Item input) {
if (_shippingBin != null && input is SObject obj && !obj.bigCraftable.Value) {
return obj.countsForShippedCollection() &&
(!Game1.player.basicShipped.ContainsKey(obj.ParentSheetIndex) || Game1.player.basicShipped[obj.ParentSheetIndex] == 0);
}
return false;
}

public Decoration Decorate(Item input) {
return new Decoration(_shippingBin!);
}
}
1 change: 1 addition & 0 deletions Informant/InformantMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public override void Entry(IModHelper modHelper) {

_api.ItemDecorators.Add(new BundleDecorator(modHelper));
_api.ItemDecorators.Add(new MuseumDecorator(modHelper));
_api.ItemDecorators.Add(new ShippingBinDecorator(modHelper));

// has to be done after registering all the tooltips and decorators
Helper.Events.GameLoop.GameLaunched += OnGameLaunched;
Expand Down
Binary file added Informant/assets/shipping_bin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Informant/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

"MuseumDecorator": "Museum-Dekoration",
"MuseumDecorator.Description": "Markiert Gegenstände, die für das Museum gebraucht werden",

"ShippingBinDecorator": "Versand-Dekoration",
"ShippingBinDecorator.Description": "Markiert Gegenstände, die noch nie versandt worden sind",

"CropTooltipGenerator" : "Nutzpflanzen-Tooltip",
"CropTooltipGenerator.Description" : "Ein Tooltip, der die Art der Nutzpflanze und die Tage bis zur Ernte zeigt",
Expand Down
3 changes: 3 additions & 0 deletions Informant/i18n/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

"MuseumDecorator": "Museum Decorator",
"MuseumDecorator.Description": "Marks items that are needed for the museum",

"ShippingBinDecorator": "Shipping Decorator",
"ShippingBinDecorator.Description": "Marks items that were not shipped yet",

"CropTooltipGenerator" : "Crops Tooltip",
"CropTooltipGenerator.Description" : "A tooltip that displays the type of crop and remaining days till harvest",
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ There are two decorators, i.e. images displayed on the regular item tooltip, tha

- ![Bundle Image](./Informant/assets/bundle.png) **Bundles Decorator** - displayed when the item is still needed for the bundles
- ![Museum Image](./Informant/assets/museum.png) **Museum Decorator** - displayed when the item is still needed for the museum
- ![Museum Image](./Informant/assets/shipping_bin.png) **Shipping Decorator** - displayed when the item was not yet shipped

#### Tooltips

Expand Down Expand Up @@ -94,6 +95,7 @@ entries is:
"machine": true,
"museum": true,
"sell-price": true,
"shipping": true,
"tree": true
},
"HideMachineTooltips": "ForNonMachines",
Expand All @@ -109,7 +111,8 @@ entries is:
| `DisplayIds.fruit-tree` | Fruit Trees Tooltip | `true` | True if the fruit trees tooltip should be activated |
| `DisplayIds.machine` | Machines Tooltip | `true` | True if the machines tooltip should be activated |
| `DisplayIds.museum` | Museum Decorator | `true` | True if the museum decorator should be activated |
| `DisplayIds.sell-price` | Sell Price Decorator | `true` | True to show the item's price on the bottom of the tooltip |
| `DisplayIds.sell-price` | Sell Price Decorator | `true` | True to show the item's price on the bottom of the tooltip |
| `DisplayIds.shipping` | Shipping Decorator | `true` | True to marks items that were not shipped yet |
| `DisplayIds.tree` | Trees Tooltip | `true` | True if the trees tooltip should be activated |
| `HideMachineTooltips` | Hide Machine Tooltips | `ForNonMachines` | `ForNonMachines` displays tooltips only on machines that do work<br>`ForChests` hides tooltips only for chests<br>`Never` displays tooltip on every item |
| `TooltipTrigger` | Tooltip Trigger | `Hover` | `Hover` to get tooltips when the mouse hovers over the item<br>`ButtonHeld` to get tooltips only when a button is held |
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Rem Release the entire solution
dotnet publish -c Release

Rem Create a ZIP for the informant
powershell -ExecutionPolicy Bypass -File .\nexusmods-build\scripts\stardew-valley-build.ps1 %cd%\Informant %cd%\build\prepare-html-for-nexus.ps1
powershell -ExecutionPolicy Bypass -File .\nexusmods-build\scripts\stardew-valley-build.ps1 %cd%\Informant %cd%\build\prepare-html-for-nexus.ps1 1

Rem Open the folder with the results
%SystemRoot%\explorer.exe "%cd%\bin"
1 change: 1 addition & 0 deletions readme/bbcode.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ There are two decorators, i.e. images displayed on the regular item tooltip, th
[list]
[*][img]https://github.com/slothsoft/stardew-informant/raw/main/Informant/assets/bundle.png[/img] [b]Bundles Decorator[/b] - displayed when the item is still needed for the bundles
[*][img]https://github.com/slothsoft/stardew-informant/raw/main/Informant/assets/museum.png[/img] [b]Museum Decorator[/b] - displayed when the item is still needed for the museum
[*][img]https://github.com/slothsoft/stardew-informant/raw/main/Informant/assets/shipping_bin.png[/img] [b]Shipping Decorator[/b] - displayed when the item is still needed to be shipped
[/list]
[size=5]Tooltips[/size]

Expand Down
Binary file removed readme/screenshot_decorators.png
Binary file not shown.
Binary file modified readme/screenshot_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd9fc63

Please sign in to comment.