Implement story

This commit is contained in:
Melledy
2025-10-27 21:39:12 -07:00
parent 08feedc766
commit f618486ced
11 changed files with 227 additions and 2 deletions

View File

@@ -39,6 +39,7 @@ public class GameData {
@Getter private static DataTable<WorldClassDef> WorldClassDataTable = new DataTable<>();
@Getter private static DataTable<GuideGroupDef> GuideGroupDataTable = new DataTable<>();
@Getter private static DataTable<StoryDef> StoryDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerDef> StarTowerDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerStageDef> StarTowerStageDataTable = new DataTable<>();

View File

@@ -0,0 +1,34 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.game.inventory.ItemParam;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.util.JsonUtils;
import lombok.Getter;
@Getter
@ResourceType(name = "Story.json")
public class StoryDef extends BaseDef {
private int Id;
private int Chapter;
private String RewardDisplay;
private transient ItemParamMap rewards;
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
var list = JsonUtils.decodeList(this.getRewardDisplay(), ItemParam.class);
if (list != null) {
rewards = ItemParamMap.fromItemParams(list);
} else {
rewards = new ItemParamMap();
}
}
}

View File

@@ -0,0 +1,27 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import lombok.Getter;
@Getter
@ResourceType(name = "StorySetSection.json")
public class StorySetSectionDef extends BaseDef {
private int Id;
private int ChapterId;
@Getter
private static IntSet chapterIds = new IntOpenHashSet();
@Override
public int getId() {
return Id;
}
@Override
public void onLoad() {
chapterIds.add(this.getChapterId());
}
}