-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemLine.cs
More file actions
21 lines (19 loc) · 802 Bytes
/
Copy pathItemLine.cs
File metadata and controls
21 lines (19 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System.Globalization;
using RustPlusBot.Abstractions.Formatting;
using RustPlusBot.Features.ItemData.Data;
namespace RustPlusBot.Features.Commands.Formatting;
/// <summary>Formats the one-line item lookup card.</summary>
internal static class ItemLine
{
/// <summary>Formats name, id, stack size, and despawn time.</summary>
/// <param name="item">The item to describe.</param>
public static string Format(ItemRecord item)
{
ArgumentNullException.ThrowIfNull(item);
var despawn = item.DespawnSeconds is { } seconds
? DurationFormat.Compact(TimeSpan.FromSeconds(seconds))
: "—";
return string.Create(CultureInfo.InvariantCulture,
$"{item.Name} (id {item.Id}) · stack {item.StackSize} · despawn {despawn}");
}
}