735bc8e8ae
Cleaner item list display Allow full item list as file Fixed online status message with new handler
25 lines
1.1 KiB
C#
25 lines
1.1 KiB
C#
using Newtonsoft.Json;
|
|
using System.Diagnostics;
|
|
|
|
namespace MinecraftDiscordBot.Models;
|
|
|
|
[JsonObject(MemberSerialization.OptIn, Description = "Describes a fluid in a Refined Storage system.", MissingMemberHandling = MissingMemberHandling.Ignore)]
|
|
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")]
|
|
public class Fluid {
|
|
[JsonProperty("amount", Required = Required.Always)]
|
|
public int Amount { get; set; }
|
|
[JsonProperty("displayName", Required = Required.Always)]
|
|
public string DisplayName { get; set; } = default!;
|
|
[JsonProperty("tags", Required = Required.DisallowNull)]
|
|
public string[]? Tags { get; set; } = default;
|
|
[JsonProperty("name", Required = Required.Always)]
|
|
public ModItemId ItemId { get; set; } = default!;
|
|
public override string ToString() => Amount > 10000
|
|
? $"{Amount / 1000.0f:n2} B of {DisplayName}"
|
|
: $"{Amount:n0} mB of {DisplayName}";
|
|
[JsonIgnore]
|
|
public string CleanDisplayName => DisplayName[1..^1];
|
|
[JsonIgnore]
|
|
public string? TagString => Tags is string[] tags ? string.Join(", ", tags) : null;
|
|
}
|