OpenConfigEntry.java 1.6 KB
Newer Older
Melledy's avatar
Melledy committed
1
package emu.grasscutter.data.binout;
Melledy's avatar
Melledy committed
2

3
import java.util.ArrayList;
Melledy's avatar
Melledy committed
4
5
import java.util.List;

6
7
import emu.grasscutter.data.ResourceLoader.OpenConfigData;

Melledy's avatar
Melledy committed
8
9
10
11
public class OpenConfigEntry {
	private String name;
	private String[] addAbilities;
	private int extraTalentIndex;
12
13
14
	private SkillPointModifier[] skillPointModifiers;

	public OpenConfigEntry(String name, OpenConfigData[] data) {
Melledy's avatar
Melledy committed
15
		this.name = name;
16
17
18
19
20
21
22
23
24
25
26
27
28
29
		
		List<String> abilityList = new ArrayList<>();
		List<SkillPointModifier> modList = new ArrayList<>();
		
		for (OpenConfigData entry : data) {
			if (entry.$type.contains("AddAbility")) {
				abilityList.add(entry.abilityName);
			} else if (entry.talentIndex > 0) {
				this.extraTalentIndex = entry.talentIndex;
			} else if (entry.$type.contains("ModifySkillPoint")) {
				modList.add(new SkillPointModifier(entry.skillID, entry.pointDelta));
			}
		}
		
Melledy's avatar
Melledy committed
30
31
32
		if (abilityList.size() > 0) {
			this.addAbilities = abilityList.toArray(new String[0]);
		}
33
34
35
36
		
		if (modList.size() > 0) {
			this.skillPointModifiers = modList.toArray(new SkillPointModifier[0]);
		}
Melledy's avatar
Melledy committed
37
38
39
40
41
42
43
44
45
46
47
48
49
	}

	public String getName() {
		return name;
	}

	public String[] getAddAbilities() {
		return addAbilities;
	}

	public int getExtraTalentIndex() {
		return extraTalentIndex;
	}
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	
	public SkillPointModifier[] getSkillPointModifiers() {
		return skillPointModifiers;
	}

	public static class SkillPointModifier {
		private int skillId;
		private int delta;
		
		public SkillPointModifier(int skillId, int delta) {
			this.skillId = skillId;
			this.delta = delta;
		}

		public int getSkillId() {
			return skillId;
		}

		public int getDelta() {
			return delta;
		}
	}
Melledy's avatar
Melledy committed
72
}