-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathUtil.cs
43 lines (38 loc) · 1.45 KB
/
Util.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections.Generic;
using StardewValley;
using StardewModdingAPI;
using Microsoft.Xna.Framework;
namespace StardewNotification
{
public static class Util
{
private const int MUSHROOM_CAVE = 2;
public static void ShowMessage(string msg)
{
var hudmsg = new HUDMessage(msg, Color.SeaGreen, StardewNotification.Config.NotificationDuration , true)
{
whatType = 2
};
Game1.addHUDMessage(hudmsg);
}
public static void ShowHarvestableMessage(ITranslationHelper Trans, KeyValuePair<string, Pair<StardewValley.Object, int>> pair)
{
var item = CopyObject(pair.Value.First);
item.name = Trans.Get("readyHarvest", new { cropName = pair.Key });
item.bigCraftable.Value = pair.Value.First.bigCraftable.Value;
Game1.addHUDMessage(new HUDMessage(pair.Key, pair.Value.Second, true, Color.OrangeRed, item));
}
public static Object CopyObject(Object source)
{
Object dst;
dst = new Object(source.ParentSheetIndex, source.Stack, false, source.Price, source.Quality);
if (Game1.player.caveChoice.Value == MUSHROOM_CAVE)
{
dst.bigCraftable.Value = source.bigCraftable.Value;
dst.TileLocation = source.TileLocation;
}
dst.Type = source.Type;
return dst;
}
}
}