QuestData.java 3.23 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;
akatatsu27's avatar
akatatsu27 committed
39
    private Guide guide;
Melledy's avatar
Melledy committed
40

akatatsu27's avatar
akatatsu27 committed
41
    //ResourceLoader not happy if you remove getId() ~~
Melledy's avatar
Melledy committed
42
	public int getId() {
Melledy's avatar
Melledy committed
43
		return subId;
Melledy's avatar
Melledy committed
44
	}
akatatsu27's avatar
akatatsu27 committed
45
46
    //Added getSubId() for clarity
    public int getSubId() {return subId;}
Melledy's avatar
Melledy committed
47
48

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

	public int getOrder() {
Melledy's avatar
Melledy committed
53
		return order;
Melledy's avatar
Melledy committed
54
55
56
	}

	public long getDescTextMapHash() {
Melledy's avatar
Melledy committed
57
		return descTextMapHash;
Melledy's avatar
Melledy committed
58
59
	}

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

	public boolean isRewind() {
Melledy's avatar
Melledy committed
65
		return isRewind;
66
67
	}

Melledy's avatar
Melledy committed
68
	public LogicType getAcceptCondComb() {
akatatsu27's avatar
akatatsu27 committed
69
		return acceptCondComb == null ? LogicType.LOGIC_NONE : acceptCondComb;
Melledy's avatar
Melledy committed
70
71
	}

Akka's avatar
Akka committed
72
73
	public List<QuestCondition> getAcceptCond() {
		return acceptCond;
Melledy's avatar
Melledy committed
74
75
76
	}

	public LogicType getFinishCondComb() {
akatatsu27's avatar
akatatsu27 committed
77
		return finishCondComb == null ? LogicType.LOGIC_NONE : finishCondComb;
Melledy's avatar
Melledy committed
78
79
	}

Akka's avatar
Akka committed
80
81
	public List<QuestCondition> getFinishCond() {
		return finishCond;
Melledy's avatar
Melledy committed
82
83
84
	}

	public LogicType getFailCondComb() {
akatatsu27's avatar
akatatsu27 committed
85
		return failCondComb == null ? LogicType.LOGIC_NONE : failCondComb;
Melledy's avatar
Melledy committed
86
87
	}

Akka's avatar
Akka committed
88
89
	public List<QuestCondition> getFailCond() {
		return failCond;
Melledy's avatar
Melledy committed
90
91
92
	}

	public void onLoad() {
Akka's avatar
Akka committed
93
94
95
96
97
98
99
		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
100
	}
Akka's avatar
Akka committed
101
102
103

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

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

Melledy's avatar
Melledy committed
124
	}
akatatsu27's avatar
akatatsu27 committed
125
126
127
128
129
130
131

    @Data
    public static class Guide {
        private String type;
        private List<String> param;
        private int guideScene;
    }
Melledy's avatar
Melledy committed
132
}