PointData.java 1.35 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;
Melledy's avatar
Melledy committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    
    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
30
31
32
        return tranPos;
    }

Melledy's avatar
Melledy committed
33
34
35
	public int[] getDungeonIds() {
		return dungeonIds;
	}
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
61
62

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

	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
63
}