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

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

Akka's avatar
Akka committed
6
import com.google.gson.annotations.SerializedName;
Melledy's avatar
Melledy committed
7
8
9
10
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.quest.enums.LogicType;
import emu.grasscutter.game.quest.enums.QuestTrigger;
Akka's avatar
Akka committed
11
12
13
14
15
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.ToString;
import lombok.experimental.FieldDefaults;
Melledy's avatar
Melledy committed
16
17

@ResourceType(name = "QuestExcelConfigData.json")
Akka's avatar
Akka committed
18
19
@Getter
@ToString
Melledy's avatar
Melledy committed
20
public class QuestData extends GameResource {
Melledy's avatar
Melledy committed
21
22
23
24
	private int subId;
	private int mainId;
	private int order;
	private long descTextMapHash;
Akka's avatar
Akka committed
25

Melledy's avatar
Melledy committed
26
27
	private boolean finishParent;
	private boolean isRewind;
Akka's avatar
Akka committed
28

Melledy's avatar
Melledy committed
29
30
31
	private LogicType acceptCondComb;
	private LogicType finishCondComb;
	private LogicType failCondComb;
Akka's avatar
Akka committed
32
33
34
35

	private List<QuestCondition> acceptCond;
	private List<QuestCondition> finishCond;
	private List<QuestCondition> failCond;
Melledy's avatar
Melledy committed
36
37
38
	private List<QuestExecParam> beginExec;
	private List<QuestExecParam> finishExec;
	private List<QuestExecParam> failExec;
Melledy's avatar
Melledy committed
39
40

	public int getId() {
Melledy's avatar
Melledy committed
41
		return subId;
Melledy's avatar
Melledy committed
42
43
44
	}

	public int getMainId() {
Melledy's avatar
Melledy committed
45
		return mainId;
Melledy's avatar
Melledy committed
46
47
48
	}

	public int getOrder() {
Melledy's avatar
Melledy committed
49
		return order;
Melledy's avatar
Melledy committed
50
51
52
	}

	public long getDescTextMapHash() {
Melledy's avatar
Melledy committed
53
		return descTextMapHash;
Melledy's avatar
Melledy committed
54
55
	}

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

	public boolean isRewind() {
Melledy's avatar
Melledy committed
61
		return isRewind;
62
63
	}

Melledy's avatar
Melledy committed
64
	public LogicType getAcceptCondComb() {
Melledy's avatar
Melledy committed
65
		return acceptCondComb;
Melledy's avatar
Melledy committed
66
67
	}

Akka's avatar
Akka committed
68
69
	public List<QuestCondition> getAcceptCond() {
		return acceptCond;
Melledy's avatar
Melledy committed
70
71
72
	}

	public LogicType getFinishCondComb() {
Melledy's avatar
Melledy committed
73
		return finishCondComb;
Melledy's avatar
Melledy committed
74
75
	}

Akka's avatar
Akka committed
76
77
	public List<QuestCondition> getFinishCond() {
		return finishCond;
Melledy's avatar
Melledy committed
78
79
80
	}

	public LogicType getFailCondComb() {
Melledy's avatar
Melledy committed
81
		return failCondComb;
Melledy's avatar
Melledy committed
82
83
	}

Akka's avatar
Akka committed
84
85
	public List<QuestCondition> getFailCond() {
		return failCond;
Melledy's avatar
Melledy committed
86
87
88
	}

	public void onLoad() {
Akka's avatar
Akka committed
89
90
91
92
93
94
95
		this.acceptCond = acceptCond.stream().filter(p -> p.type != null).toList();
		this.finishCond = finishCond.stream().filter(p -> p.type != null).toList();
		this.failCond = failCond.stream().filter(p -> p.type != null).toList();

        this.beginExec = beginExec.stream().filter(p -> p.type != null).toList();
        this.finishExec = finishExec.stream().filter(p -> p.type != null).toList();
        this.failExec = failExec.stream().filter(p -> p.type != null).toList();
Melledy's avatar
Melledy committed
96
	}
Akka's avatar
Akka committed
97
98
99

    @Data
    @FieldDefaults(level = AccessLevel.PRIVATE)
Melledy's avatar
Melledy committed
100
	public class QuestExecParam {
Akka's avatar
Akka committed
101
102
103
104
105
106
        @SerializedName("_type")
		QuestTrigger type;
        @SerializedName("_param")
		String[] param;
        @SerializedName("_count")
		String count;
Melledy's avatar
Melledy committed
107
	}
Akka's avatar
Akka committed
108
109

    @Data
Melledy's avatar
Melledy committed
110
	public static class QuestCondition {
Akka's avatar
Akka committed
111
        @SerializedName("_type")
Melledy's avatar
Melledy committed
112
		private QuestTrigger type;
Akka's avatar
Akka committed
113
        @SerializedName("_param")
Melledy's avatar
Melledy committed
114
		private int[] param;
Akka's avatar
Akka committed
115
116
117
        @SerializedName("_param_str")
		private String paramStr;
        @SerializedName("_count")
Melledy's avatar
Melledy committed
118
		private String count;
Akka's avatar
Akka committed
119

Melledy's avatar
Melledy committed
120
121
	}
}