SceneSuite.java 1.92 KB
Newer Older
1
2
package emu.grasscutter.scripts.data;

3
import java.util.ArrayList;
4
5
import java.util.List;

Akka's avatar
Akka committed
6
7
import lombok.Setter;
import lombok.ToString;
8

Akka's avatar
Akka committed
9
10
@ToString
@Setter
11
public class SceneSuite {
12
13
14
15
16
    // make it refer the default empty list to avoid NPE caused by some group 
	public List<Integer> monsters = List.of();
	public List<Integer> gadgets = List.of();
	public List<String> triggers = List.of();
    public List<Integer> regions = List.of();
Akka's avatar
Akka committed
17
18
    public int rand_weight;

19
20
21
22
	public transient List<SceneMonster> sceneMonsters = List.of();
	public transient List<SceneGadget> sceneGadgets = List.of();
	public transient List<SceneTrigger> sceneTriggers = List.of();
    public transient List<SceneRegion> sceneRegions = List.of();
Akka's avatar
Akka committed
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
    public void init(SceneGroup sceneGroup) {
        if(sceneGroup.monsters != null){
            this.sceneMonsters = new ArrayList<>(
                this.monsters.stream()
                    .filter(sceneGroup.monsters::containsKey)
                    .map(sceneGroup.monsters::get)
                    .toList()
            );
        }

        if(sceneGroup.gadgets != null){
            this.sceneGadgets = new ArrayList<>(
                this.gadgets.stream()
                    .filter(sceneGroup.gadgets::containsKey)
                    .map(sceneGroup.gadgets::get)
                    .toList()
            );
        }

        if(sceneGroup.triggers != null) {
            this.sceneTriggers = new ArrayList<>(
                this.triggers.stream()
                    .filter(sceneGroup.triggers::containsKey)
                    .map(sceneGroup.triggers::get)
                    .toList()
            );
        }
        if(sceneGroup.regions != null) {
            this.sceneRegions = new ArrayList<>(
                this.regions.stream()
                    .filter(sceneGroup.regions::containsKey)
                    .map(sceneGroup.regions::get)
                    .toList()
            );
        }

    }
61
}