ReliquaryLevelData.java 1.46 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
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty;
Melledy's avatar
Melledy committed
8
9
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
Melledy's avatar
Melledy committed
10
11
12
13
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

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