mirror of
https://github.com/Melledy/Nebula.git
synced 2026-11-04 21:36:51 +01:00
Implement monolith potential book
This commit is contained in:
1 parent
b7d6278b26
commit
465ccd769e
14 files changed
+403
-3
No files matched your search
@@ -118,6 +118,7 @@ public class GameData {
|
||||
@Getter private static DataTable<StarTowerTeamExpDef> StarTowerTeamExpDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerEventDef> StarTowerEventDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerBuildRankDef> StarTowerBuildRankDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<StarTowerBookPotentialRewardDef> StarTowerBookPotentialRewardDataTable = new DataTable<>();
|
||||
@Getter private static DataTable<SubNoteSkillPromoteGroupDef> SubNoteSkillPromoteGroupDataTable = new DataTable<>();
|
||||
|
||||
@Getter private static DataTable<PotentialDef> PotentialDataTable = new DataTable<>();
|
||||
|
||||
@@ -6,7 +6,11 @@ import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.game.character.ElementType;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@@ -36,6 +40,7 @@ public class CharacterDef extends BaseDef {
|
||||
private transient HonorDef honor;
|
||||
private transient ElementType elementType;
|
||||
private transient List<ChatDef> chats;
|
||||
private transient Int2ObjectMap<StarTowerBookPotentialRewardDef> potentialBookRewards;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
@@ -67,5 +72,6 @@ public class CharacterDef extends BaseDef {
|
||||
public void onLoad() {
|
||||
this.elementType = ElementType.getByValue(this.EET);
|
||||
this.chats = new ObjectArrayList<>();
|
||||
this.potentialBookRewards = new Int2ObjectLinkedOpenHashMap<>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import emu.nebula.data.BaseDef;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.data.ResourceType;
|
||||
import emu.nebula.data.ResourceType.LoadPriority;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = "StarTowerBookPotentialReward.json", loadPriority = LoadPriority.LOW)
|
||||
public class StarTowerBookPotentialRewardDef extends BaseDef {
|
||||
private int Id;
|
||||
private int CharId;
|
||||
private int Sort;
|
||||
private String Params;
|
||||
private int ItemId;
|
||||
private int ItemQty;
|
||||
|
||||
// Cached data
|
||||
private transient int[] conditions;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public int getRequiredPotentials() {
|
||||
if (this.conditions == null || this.conditions.length < 2) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
return this.conditions[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.conditions = Arrays.stream(Params.replaceAll("[\\[\\] ]", "")
|
||||
.split(","))
|
||||
.mapToInt(Integer::parseInt)
|
||||
.toArray();
|
||||
|
||||
var characterDef = GameData.getCharacterDataTable().get(this.CharId);
|
||||
if (characterDef != null) {
|
||||
characterDef.getPotentialBookRewards().put(this.getSort(), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user