Commit d8816911 authored by Benj's avatar Benj Committed by Luke H-W
Browse files

Make PointData compatible with alternative PointData



Original Commit Message: Make PointData compatible with windied scene points.
Gitea Author: GanyusLeftHorn
Co-authored-by: default avatarGanyusLeftHorn <1244229+GanyusLeftHorn@users.noreply.github.com>
parent cb97ac82
package emu.grasscutter.data.common; package emu.grasscutter.data.common;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData; import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.DailyDungeonData; import emu.grasscutter.data.excels.DailyDungeonData;
import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Position;
import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
public class PointData { public class PointData {
private int id; private int id;
private String $type; private String $type;
private Position tranPos; private Position tranPos;
@SerializedName(value="dungeonIds", alternate={"JHHFPGJNMIN"}) @SerializedName(value="dungeonIds", alternate={"JHHFPGJNMIN"})
private int[] dungeonIds; private int[] dungeonIds;
@SerializedName(value="dungeonRandomList", alternate={"OIBKFJNBLHO"}) @SerializedName(value="dungeonRandomList", alternate={"OIBKFJNBLHO"})
private int[] dungeonRandomList; private int[] dungeonRandomList;
@SerializedName(value="tranSceneId", alternate={"JHBICGBAPIH"}) @SerializedName(value="tranSceneId", alternate={"JHBICGBAPIH"})
private int tranSceneId; private int tranSceneId;
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
public String getType() { public String getType() {
return $type; return $type;
} }
public Position getTranPos() { public Position getTranPos() {
return tranPos; return tranPos;
} }
public int[] getDungeonIds() { public int[] getDungeonIds() {
return dungeonIds; return dungeonIds;
} }
public int[] getDungeonRandomList() { public int[] getDungeonRandomList() {
return dungeonRandomList; return dungeonRandomList;
} }
public int getTranSceneId() { public int getTranSceneId() {
return tranSceneId; return tranSceneId;
} }
public void setTranSceneId(int tranSceneId) { public void setTranSceneId(int tranSceneId) {
this.tranSceneId = tranSceneId; this.tranSceneId = tranSceneId;
} }
public void updateDailyDungeon() { public void updateDailyDungeon() {
if (getDungeonRandomList() == null) { if (getDungeonRandomList() == null || getDungeonRandomList().length == 0) {
return; return;
} }
IntList newDungeons = new IntArrayList(); IntList newDungeons = new IntArrayList();
int day = Grasscutter.getCurrentDayOfWeek(); int day = Grasscutter.getCurrentDayOfWeek();
for (int randomId : getDungeonRandomList()) { for (int randomId : getDungeonRandomList()) {
DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId); DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId);
if (data != null) { if (data != null) {
int[] addDungeons = data.getDungeonsByDay(day); int[] addDungeons = data.getDungeonsByDay(day);
for (int d : addDungeons) { for (int d : addDungeons) {
newDungeons.add(d); newDungeons.add(d);
} }
} }
} }
this.dungeonIds = newDungeons.toIntArray(); this.dungeonIds = newDungeons.toIntArray();
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment