mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-19 17:19:58 +02:00
Implement heartlink invite
This commit is contained in:
@@ -28,18 +28,24 @@ public class GameData {
|
||||
@Getter private static DataTable<TalentGroupDef> TalentGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<TalentDef> TalentDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<AffinityLevelDef> AffinityLevelDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<AffinityGiftDef> AffinityGiftDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<PlotDef> PlotDataTable = new DataTable<>();
|
||||
|
||||
// Character emblems
|
||||
@Getter private static DataTable<CharGemDef> CharGemDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemSlotControlDef> CharGemSlotControlDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemAttrGroupDef> CharGemAttrGroupDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemAttrTypeDef> CharGemAttrTypeDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<CharGemAttrValueDef> CharGemAttrValueDataTable = new DataTable<>();
|
||||
|
||||
// Character affinity
|
||||
@Getter private static DataTable<AffinityLevelDef> AffinityLevelDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<AffinityGiftDef> AffinityGiftDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<PlotDef> PlotDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<ChatDef> ChatDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<DatingLandmarkDef> DatingLandmarkDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DatingLandmarkEventDef> DatingLandmarkEventDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DatingCharacterEventDef> DatingCharacterEventDataTable = new DataTable<>();
|
||||
|
||||
// Discs
|
||||
@Getter private static DataTable<DiscDef> DiscDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<DiscStrengthenDef> DiscStrengthenDataTable = new DataTable<>();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.data.ResourceType.LoadPriority;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "DatingBranch.json", loadPriority = LoadPriority.LOW)
|
||||
public class DatingBranchDef extends BaseDef {
|
||||
private int Id;
|
||||
private int DatingEventType;
|
||||
private int[] DatingEventParams;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getLandmarkId() {
|
||||
if (this.DatingEventParams.length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.DatingEventParams[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.data.ResourceType.LoadPriority;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "DatingCharacterEvent.json", loadPriority = LoadPriority.LOW)
|
||||
public class DatingCharacterEventDef extends DatingLandmarkEventDef {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.game.dating.DatingEvent;
|
||||
import emu.nebula.util.Utils;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "DatingLandmark.json")
|
||||
public class DatingLandmarkDef extends BaseDef {
|
||||
private int Id;
|
||||
|
||||
private transient List<DatingEvent> afterBranches;
|
||||
private transient Object2ObjectMap<String, List<DatingEvent>> characterEvents;
|
||||
private transient Object2ObjectMap<String, List<DatingEvent>> landmarkEvents;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getRandomAfterBranchId() {
|
||||
var event = Utils.randomElement(this.afterBranches);
|
||||
|
||||
if (event == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return event.getId();
|
||||
}
|
||||
|
||||
public int getRandomCharacterEventId() {
|
||||
var list = new ArrayList<DatingEvent>();
|
||||
|
||||
for (var events : this.characterEvents.values()) {
|
||||
list.addAll(events);
|
||||
}
|
||||
|
||||
// Get random event
|
||||
var event = Utils.randomElement(list);
|
||||
|
||||
if (event == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return event.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.afterBranches = new ArrayList<>();
|
||||
this.characterEvents = new Object2ObjectOpenHashMap<>();
|
||||
this.landmarkEvents = new Object2ObjectOpenHashMap<>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.data.ResourceType.LoadPriority;
|
||||
import emu.nebula.game.dating.DatingEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "DatingLandmarkEvent.json", loadPriority = LoadPriority.LOW)
|
||||
public class DatingLandmarkEventDef extends BaseDef implements DatingEvent {
|
||||
private int Id;
|
||||
private int DatingEventType;
|
||||
private int Affinity;
|
||||
private int[] DatingEventParams;
|
||||
private String Response;
|
||||
|
||||
private transient emu.nebula.game.dating.DatingEventType type;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getLandmarkId() {
|
||||
if (this.DatingEventParams.length <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.DatingEventParams[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Cache dating event type
|
||||
this.type = emu.nebula.game.dating.DatingEventType.getByValue(this.getDatingEventType());
|
||||
|
||||
// Add to landmark data
|
||||
var data = GameData.getDatingLandmarkDataTable().get(this.getLandmarkId());
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this.getType()) {
|
||||
case Landmark -> {
|
||||
data.getLandmarkEvents()
|
||||
.computeIfAbsent(this.getResponse(), s -> new ArrayList<>())
|
||||
.add(this);
|
||||
}
|
||||
case Regular -> {
|
||||
data.getCharacterEvents()
|
||||
.computeIfAbsent(this.getResponse(), s -> new ArrayList<>())
|
||||
.add(this);
|
||||
}
|
||||
case AfterBranch -> {
|
||||
data.getAfterBranches().add(this);
|
||||
}
|
||||
default -> {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user