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

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
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
63
64
65
66
67
	private int id;
	private Int2ObjectMap<Float> propMap;
	
	private int Rank;
	private int Level;
	private int Exp;
	private List<RelicLevelProperty> AddProps;
	
	@Override
	public int getId() {
		return this.id;
	}
	
	public int getRank() {
		return Rank;
	}
	
	public int getLevel() {
		return Level;
	}
	
	public int getExp() {
		return Exp;
	}
	
	public float getPropValue(FightProperty prop) {
		return getPropValue(prop.getId());
	}
	
	public float getPropValue(int id) {
		return propMap.get(id);
	}
	
	@Override
	public void onLoad() {
		this.id = (Rank << 8) + this.getLevel();
		this.propMap = new Int2ObjectOpenHashMap<>();
		for (RelicLevelProperty p : AddProps) {
			this.propMap.put(FightProperty.getPropByName(p.getPropType()).getId(), (Float) p.getValue());
		}
	}
	
	public class RelicLevelProperty {
		private String PropType;
		private float Value;
		
		public String getPropType() {
			return PropType;
		}
		
		public float getValue() {
			return Value;
		}
	}
}