ReliquaryLevelData.java 1.37 KB
Newer Older
Melledy's avatar
Melledy committed
1
package emu.grasscutter.data.excels;
Melledy's avatar
Melledy committed
2
3
4

import java.util.List;

5
import emu.grasscutter.data.GameResource;
Melledy's avatar
Melledy committed
6
7
8
9
10
11
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

@ResourceType(name = "ReliquaryLevelExcelConfigData.json")
12
public class ReliquaryLevelData extends GameResource {
Melledy's avatar
Melledy committed
13
14
15
	private int id;
	private Int2ObjectMap<Float> propMap;
	
Melledy's avatar
Melledy committed
16
17
18
19
	private int rank;
	private int level;
	private int exp;
	private List<RelicLevelProperty> addProps;
Melledy's avatar
Melledy committed
20
21
22
23
24
25
26
	
	@Override
	public int getId() {
		return this.id;
	}
	
	public int getRank() {
Melledy's avatar
Melledy committed
27
		return rank;
Melledy's avatar
Melledy committed
28
29
30
	}
	
	public int getLevel() {
Melledy's avatar
Melledy committed
31
		return level;
Melledy's avatar
Melledy committed
32
33
34
	}
	
	public int getExp() {
Melledy's avatar
Melledy committed
35
		return exp;
Melledy's avatar
Melledy committed
36
37
38
39
40
41
42
43
44
45
46
47
	}
	
	public float getPropValue(FightProperty prop) {
		return getPropValue(prop.getId());
	}
	
	public float getPropValue(int id) {
		return propMap.get(id);
	}
	
	@Override
	public void onLoad() {
Melledy's avatar
Melledy committed
48
		this.id = (rank << 8) + this.getLevel();
Melledy's avatar
Melledy committed
49
		this.propMap = new Int2ObjectOpenHashMap<>();
Melledy's avatar
Melledy committed
50
		for (RelicLevelProperty p : addProps) {
Melledy's avatar
Melledy committed
51
52
53
54
55
			this.propMap.put(FightProperty.getPropByName(p.getPropType()).getId(), (Float) p.getValue());
		}
	}
	
	public class RelicLevelProperty {
Melledy's avatar
Melledy committed
56
57
		private String propType;
		private float value;
Melledy's avatar
Melledy committed
58
59
		
		public String getPropType() {
Melledy's avatar
Melledy committed
60
			return propType;
Melledy's avatar
Melledy committed
61
62
63
		}
		
		public float getValue() {
Melledy's avatar
Melledy committed
64
			return value;
Melledy's avatar
Melledy committed
65
66
67
		}
	}
}