-
Notifications
You must be signed in to change notification settings - Fork 48
/
WorldBossKillRewardSheet.cs
62 lines (56 loc) · 1.89 KB
/
WorldBossKillRewardSheet.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
62
using System;
using System.Collections.Generic;
using Libplanet.Action;
using static Nekoyume.TableData.TableExtensions;
namespace Nekoyume.TableData
{
public class WorldBossKillRewardSheet : Sheet<int, WorldBossKillRewardSheet.Row>, IWorldBossRewardSheet
{
public class Row : SheetRow<int>, IWorldBossRewardRow
{
private int _rune;
private bool _initializedRune;
public int Id;
public int BossId { get; private set; }
public int Rank { get; private set; }
public int RuneMin;
public int RuneMax;
public int Crystal { get; private set; }
public int Circle { get; private set; }
public int Rune {
get
{
if (!_initializedRune)
{
throw new Exception();
}
return _rune;
}
private set => _rune = value;
}
public override int Key => Id;
public override void Set(IReadOnlyList<string> fields)
{
Id = ParseInt(fields[0]);
BossId = ParseInt(fields[1]);
Rank = ParseInt(fields[2]);
RuneMin = ParseInt(fields[3]);
RuneMax = ParseInt(fields[4]);
Crystal = ParseInt(fields[5]);
if (fields.Count > 6)
{
Circle = ParseInt(fields[6]);
}
}
public void SetRune(IRandom random)
{
_initializedRune = true;
Rune = random.Next(RuneMin, RuneMax + 1);
}
}
public WorldBossKillRewardSheet() : base(nameof(WorldBossKillRewardSheet))
{
}
public IReadOnlyList<IWorldBossRewardRow> OrderedRows => OrderedList;
}
}