QuestData.java 2.7 KB
Newer Older
Melledy's avatar
Melledy committed
1
package emu.grasscutter.data.excels;
Melledy's avatar
Melledy committed
2
3
4
5
6
7
8
9
10
11
12

import java.util.Arrays;
import java.util.List;

import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.quest.enums.LogicType;
import emu.grasscutter.game.quest.enums.QuestTrigger;

@ResourceType(name = "QuestExcelConfigData.json")
public class QuestData extends GameResource {
Melledy's avatar
Melledy committed
13
14
15
16
	private int subId;
	private int mainId;
	private int order;
	private long descTextMapHash;
Melledy's avatar
Melledy committed
17
	
Melledy's avatar
Melledy committed
18
19
	private boolean finishParent;
	private boolean isRewind;
20
	
Melledy's avatar
Melledy committed
21
	private LogicType acceptCondComb;
Melledy's avatar
Melledy committed
22
	private QuestCondition[] acceptConditons;
Melledy's avatar
Melledy committed
23
	private LogicType finishCondComb;
Melledy's avatar
Melledy committed
24
	private QuestCondition[] finishConditons;
Melledy's avatar
Melledy committed
25
	private LogicType failCondComb;
Melledy's avatar
Melledy committed
26
27
	private QuestCondition[] failConditons;
	
Melledy's avatar
Melledy committed
28
29
30
31
32
33
	private List<QuestParam> acceptCond;
	private List<QuestParam> finishCond;
	private List<QuestParam> failCond;
	private List<QuestExecParam> beginExec;
	private List<QuestExecParam> finishExec;
	private List<QuestExecParam> failExec;
Melledy's avatar
Melledy committed
34
35

	public int getId() {
Melledy's avatar
Melledy committed
36
		return subId;
Melledy's avatar
Melledy committed
37
38
39
	}

	public int getMainId() {
Melledy's avatar
Melledy committed
40
		return mainId;
Melledy's avatar
Melledy committed
41
42
43
	}

	public int getOrder() {
Melledy's avatar
Melledy committed
44
		return order;
Melledy's avatar
Melledy committed
45
46
47
	}

	public long getDescTextMapHash() {
Melledy's avatar
Melledy committed
48
		return descTextMapHash;
Melledy's avatar
Melledy committed
49
50
	}

51
	public boolean finishParent() {
Melledy's avatar
Melledy committed
52
		return finishParent;
53
54
55
	}

	public boolean isRewind() {
Melledy's avatar
Melledy committed
56
		return isRewind;
57
58
	}

Melledy's avatar
Melledy committed
59
	public LogicType getAcceptCondComb() {
Melledy's avatar
Melledy committed
60
		return acceptCondComb;
Melledy's avatar
Melledy committed
61
62
63
64
65
66
67
	}

	public QuestCondition[] getAcceptCond() {
		return acceptConditons;
	}

	public LogicType getFinishCondComb() {
Melledy's avatar
Melledy committed
68
		return finishCondComb;
Melledy's avatar
Melledy committed
69
70
71
72
73
74
75
	}

	public QuestCondition[] getFinishCond() {
		return finishConditons;
	}

	public LogicType getFailCondComb() {
Melledy's avatar
Melledy committed
76
		return failCondComb;
Melledy's avatar
Melledy committed
77
78
79
80
81
82
83
	}

	public QuestCondition[] getFailCond() {
		return failConditons;
	}

	public void onLoad() {
Melledy's avatar
Melledy committed
84
85
86
87
88
89
		this.acceptConditons = acceptCond.stream().filter(p -> p.Type != null).map(QuestCondition::new).toArray(QuestCondition[]::new);
		acceptCond = null;
		this.finishConditons = finishCond.stream().filter(p -> p.Type != null).map(QuestCondition::new).toArray(QuestCondition[]::new);
		finishCond = null;
		this.failConditons = failCond.stream().filter(p -> p.Type != null).map(QuestCondition::new).toArray(QuestCondition[]::new);
		failCond = null;
Melledy's avatar
Melledy committed
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	}
	
	public class QuestParam {
		QuestTrigger Type;
		int[] Param;
		String count;
	}
	
	public class QuestExecParam {
		QuestTrigger Type;
		String[] Param;
		String count;
	}
	
	public static class QuestCondition {
		private QuestTrigger type;
		private int[] param;
		private String count;
		
		public QuestCondition(QuestParam param) {
			this.type = param.Type;
			this.param = param.Param;
		}
		
		public QuestTrigger getType() {
			return type;
		}
		
		public int[] getParam() {
			return param;
		}

		public String getCount() {
			return count;
		}
	}
}