-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathMaterialPresence.cs
More file actions
37 lines (29 loc) · 1.13 KB
/
MaterialPresence.cs
File metadata and controls
37 lines (29 loc) · 1.13 KB
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
using Newtonsoft.Json;
using System;
using Utilities;
namespace EddiDataDefinitions
{
/// <summary>
/// Presence of a material
/// </summary>
public class MaterialPresence ( Material definition, decimal percentage )
{
[PublicAPI, JsonProperty("material")]
public string name { get; private set; } = definition?.localizedName;
[PublicAPI]
public string category => definition?.category;
[PublicAPI]
public string rarity => definition?.Rarity.localizedName;
[PublicAPI]
public decimal percentage { get; private set; } = percentage;
// Not intended to be user facing
[JsonIgnore]
public Material definition { get; private set; } = definition;
[JsonIgnore, Obsolete("We merged this with MaterialPercentage (which is now gone) but old scripts used different keys for the material's name so put them both here")]
public string material => name;
[JsonConstructor]
public MaterialPresence(string material, decimal percentage)
: this(Material.FromName(material), percentage)
{ }
}
}