-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathRuneWeightSheet.cs
61 lines (53 loc) · 1.52 KB
/
RuneWeightSheet.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using System.Linq;
using static Nekoyume.TableData.TableExtensions;
namespace Nekoyume.TableData
{
public class RuneWeightSheet : Sheet<int, RuneWeightSheet.Row>
{
public class RuneInfo
{
public int RuneId;
public decimal Weight;
public RuneInfo(int runeId, decimal weight)
{
RuneId = runeId;
Weight = weight;
}
}
public class Row : SheetRow<int>
{
public override int Key => Id;
public int Id;
public int BossId;
public int Rank;
public List<RuneInfo> RuneInfos;
public override void Set(IReadOnlyList<string> fields)
{
Id = ParseInt(fields[0]);
BossId = ParseInt(fields[1]);
Rank = ParseInt(fields[2]);
RuneInfos = new List<RuneInfo>
{
new RuneInfo(ParseInt(fields[3]), ParseDecimal(fields[4]))
};
}
}
public RuneWeightSheet() : base(nameof(RuneWeightSheet))
{
}
protected override void AddRow(int key, Row value)
{
if (!TryGetValue(key, out var row))
{
Add(key, value);
return;
}
if (!value.RuneInfos.Any())
{
return;
}
row.RuneInfos.Add(value.RuneInfos[0]);
}
}
}