Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SeedInfo] Update to 1.6 #137

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions SeedInfo/CodePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using StardewModdingAPI;
using StardewValley;
using StardewValley.BellsAndWhistles;
using StardewValley.GameData.Shops;
using StardewValley.Menus;
using StardewValley.Network;
using StardewValley.Objects;
Expand All @@ -21,9 +22,9 @@ namespace SeedInfo
{
public partial class ModEntry
{
public static Dictionary<int, SeedEntryInfo> shopDict = new();
public static Dictionary<string, SeedEntryInfo> shopDict = new();

[HarmonyPatch(typeof(ShopMenu), nameof(IClickableMenu.draw), new Type[] { typeof(List<ISalable>), typeof(int), typeof(string), typeof(Func<ISalable, Farmer, int, bool>), typeof(Func<ISalable, bool>), typeof(string) })]
[HarmonyPatch(typeof(ShopMenu), nameof(IClickableMenu.draw), new Type[] { typeof(string), typeof(ShopData), typeof(ShopOwnerData), typeof(NPC), typeof(Func<ISalable, Farmer, int, bool>), typeof(Func<ISalable, bool>), typeof(bool) })]
[HarmonyPatch(MethodType.Constructor)]
public class ShopMenu_Patch
{
Expand All @@ -37,7 +38,7 @@ public static void Postfix(ShopMenu __instance)
{
if (__instance.forSale[i] is not Object || (__instance.forSale[i] as Object).Category != Object.SeedsCategory)
continue;
shopDict[((Object)__instance.forSale[i]).ParentSheetIndex] = new SeedEntryInfo((Object)__instance.forSale[i]);
shopDict[((Object)__instance.forSale[i]).QualifiedItemId] = new SeedEntryInfo((Object)__instance.forSale[i]);
}
}
}
Expand Down
352 changes: 228 additions & 124 deletions SeedInfo/Methods.cs

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions SeedInfo/ModConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ public class ModConfig
public bool ModEnabled { get; set; } = true;
public int DaysPerMonth { get; set; } = 28;
public Color PriceColor { get; set; } = new Color(100, 25, 25);
public bool DisplayMead { get; set; } = true;
public bool DisplayCrop { get; set; } = true;
public bool DisplayPickle { get; set; } = true;
public bool DisplayKeg { get; set; } = true;
public bool DisplayDehydrator { get; set; } = true;
public bool DivideDehydrate { get; set; } = false;
}
}
42 changes: 42 additions & 0 deletions SeedInfo/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,48 @@ public void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLa
min: 0,
max: 255
);
configMenu.AddBoolOption(
mod: ModManifest,
name: () => "Display Mead",
tooltip: () => "Whether to display mead as the keg option for flowers, which have no keg option otherwise.",
getValue: () => Config.DisplayMead,
setValue: value => Config.DisplayMead = value
);
configMenu.AddBoolOption(
mod: ModManifest,
name: () => "Display Crop",
tooltip: () => "Whether to display the base crop value in the shop menu.",
getValue: () => Config.DisplayCrop,
setValue: value => Config.DisplayCrop = value
);
configMenu.AddBoolOption(
mod: ModManifest,
name: () => "Display Pickle",
tooltip: () => "Whether to display the preserve jar output in the shop menu.",
getValue: () => Config.DisplayPickle,
setValue: value => Config.DisplayPickle = value
);
configMenu.AddBoolOption(
mod: ModManifest,
name: () => "Display Keg",
tooltip: () => "Whether to display the keg output in the shop menu.",
getValue: () => Config.DisplayKeg,
setValue: value => Config.DisplayKeg = value
);
configMenu.AddBoolOption(
mod: ModManifest,
name: () => "Display Dehydrate",
tooltip: () => "Whether to display the dehydrator output in the shop menu.",
getValue: () => Config.DisplayDehydrator,
setValue: value => Config.DisplayDehydrator = value
);
configMenu.AddBoolOption(
mod: ModManifest,
name: () => "Divide Dehydrate Value",
tooltip: () => "Whether to divide the dehydrator value by five to reflect the value per item.",
getValue: () => Config.DivideDehydrate,
setValue: value => Config.DivideDehydrate = value
);
}

}
Expand Down
11 changes: 10 additions & 1 deletion SeedInfo/SeedEntryInfo.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using HarmonyLib;
using StardewValley;
using StardewValley.Extensions;
using System.Collections.Generic;

namespace SeedInfo
{
public class SeedEntryInfo
{
public List<QualityInfo> info = new();
public int needFertilizer;
public string needFertilizer;

public SeedEntryInfo(Object seed)
{
Expand All @@ -26,14 +27,22 @@ public class QualityInfo
public ObjectInfo crop;
public ObjectInfo pickle;
public ObjectInfo keg;
public ObjectInfo dehydrate;
public QualityInfo(Object seed, int q)
{
quality = q;
crop = ModEntry.GetCrop(seed, q);
if (crop == null)
{
return;
}
pickle = ModEntry.GetPickle(crop.obj, q);
keg = ModEntry.GetKeg(crop.obj, q);
dehydrate = ModEntry.GetDehydrator(crop.obj, q);
if(ModEntry.Config.DivideDehydrate && dehydrate is not null)
{
dehydrate.price /= 5;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion SeedInfo/SeedInfo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0</Version>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<EnableHarmony>true</EnableHarmony>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
Expand Down
7 changes: 7 additions & 0 deletions SeedInfo/i18n/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"need-fertilizer--1": "Es demasiado tarde en la estación para plantar esto hoy.",
"need-fertilizer-0": "Hay suficiente días en la estación para plantar esto hoy.",
"need-fertilizer-465": "Tendrás que usar acelerador básico si plantas esto hoy.",
"need-fertilizer-466": "Tendrás que usar acelerador deluxe si plantas esto hoy.",
"need-fertilizer-918": "Tendrás que usar fertilizante ultra-rápido si plantas esto hoy."
}
7 changes: 7 additions & 0 deletions SeedInfo/i18n/pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"need-fertilizer--1": "É tarde demais na estação para plantar isso hoje.",
"need-fertilizer-0": "Há dias suficientes restantes na estação para plantar isso hoje.",
"need-fertilizer-465": "Você precisará usar o Solo Foliar se plantar isso hoje.",
"need-fertilizer-466": "Você precisará usar o Solo Foliar Premium se plantar isso hoje.",
"need-fertilizer-918": "Você precisará usar o Hiper Solo Foliar se plantar isso hoje."
}
7 changes: 7 additions & 0 deletions SeedInfo/i18n/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"need-fertilizer--1": "今天种植已经太晚了。",
"need-fertilizer-0": "今天种植还来得及。",
"need-fertilizer-465": "今天种植需要生长激素。",
"need-fertilizer-466": "今天种植需要高级生长激素。",
"need-fertilizer-918": "今天种植需要顶级生长激素。"
}
4 changes: 2 additions & 2 deletions SeedInfo/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Name": "Seed Info",
"Author": "aedenthorn",
"Version": "0.1.1",
"Version": "0.1.2",
"Description": "Seed Info.",
"UniqueID": "aedenthorn.SeedInfo",
"EntryDll": "SeedInfo.dll",
"MinimumApiVersion": "3.15.0",
"MinimumApiVersion": "4.0.0",
"ModUpdater": {
"Repository": "StardewValleyMods",
"User": "aedenthorn",
Expand Down