PointData.java 1.52 KB
Newer Older
Yazawazi's avatar
Yazawazi committed
1
2
package emu.grasscutter.data.common;

3
4
5
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.def.DailyDungeonData;
Melledy's avatar
Melledy committed
6
import emu.grasscutter.utils.Position;
7
8
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
Yazawazi's avatar
Yazawazi committed
9

Melledy's avatar
Melledy committed
10
11
12
13
14
public class PointData {
	private int id;
	private String $type;
    private Position tranPos;
    private int[] dungeonIds;
15
    private int[] dungeonRandomList;
Akka's avatar
Akka committed
16
17

	private int tranSceneId;
Melledy's avatar
Melledy committed
18
19
20
21
22
23
24
25
26
27
28
29
30
    public int getId() {
		return id;
	}
    
    public void setId(int id) {
		this.id = id;
	}

    public String getType() {
		return $type;
	}

	public Position getTranPos() {
Yazawazi's avatar
Yazawazi committed
31
32
33
        return tranPos;
    }

Melledy's avatar
Melledy committed
34
35
36
	public int[] getDungeonIds() {
		return dungeonIds;
	}
37
38
39
40
41

	public int[] getDungeonRandomList() {
		return dungeonRandomList;
	}

Akka's avatar
Akka committed
42
43
44
45
46
47
48
49
	public int getTranSceneId() {
		return tranSceneId;
	}

	public void setTranSceneId(int tranSceneId) {
		this.tranSceneId = tranSceneId;
	}

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	public void updateDailyDungeon() {
		if (getDungeonRandomList() == null) {
			return;
		}
		
		IntList newDungeons = new IntArrayList();
		int day = Grasscutter.getCurrentDayOfWeek();
		
		for (int randomId : getDungeonRandomList()) {
			DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId);
			
			if (data != null) {
				int[] addDungeons = data.getDungeonsByDay(day);
				
				for (int d : addDungeons) {
					newDungeons.add(d);
				}
			}
		}
		
		this.dungeonIds = newDungeons.toIntArray();
	}
Yazawazi's avatar
Yazawazi committed
72
}