Add record viewing to boss blitz leaderboard

This commit is contained in:
Melledy
2026-04-18 01:45:11 -07:00
parent a8c64e5a78
commit 58b89ee4a2
3 changed files with 82 additions and 1 deletions
@@ -67,6 +67,17 @@ public class ItemParamMap extends Int2IntLinkedOpenHashMap implements ObjectBidi
return params;
}
@Override
public ItemParamMap clone() {
var map = new ItemParamMap();
for (var entry : this) {
map.put(entry.getIntKey(), entry.getIntValue());
}
return map;
}
// Iterable
@Override
@@ -145,7 +156,7 @@ public class ItemParamMap extends Int2IntLinkedOpenHashMap implements ObjectBidi
return map;
}
//
// Static helpers
public static ItemParamMap of(int... entries) {
// Create
@@ -10,10 +10,13 @@ import emu.nebula.database.GameDatabaseObject;
import emu.nebula.game.player.Player;
import emu.nebula.game.tower.StarTowerBuild;
import emu.nebula.game.character.GameCharacter;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.proto.JointDrillRank.JointDrillRankChar;
import emu.nebula.proto.JointDrillRank.JointDrillRankData;
import emu.nebula.proto.JointDrillRank.JointDrillRankTeam;
import emu.nebula.proto.Public.HonorInfo;
import emu.nebula.proto.Public.ItemTpl;
import emu.nebula.proto.PublicStarTower.BuildPotential;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import lombok.Getter;
@@ -153,6 +156,10 @@ public class JointDrillRankEntry implements GameDatabaseObject {
private int damage;
private int time;
private List<JointDrillCharEntry> characters;
private int[] discs;
private ItemParamMap potentials;
private ItemParamMap notes;
private int[] secondaryIds;
@Deprecated // Morphia only
public JointDrillTeamEntry() {
@@ -164,6 +171,10 @@ public class JointDrillRankEntry implements GameDatabaseObject {
this.buildScore = build.getScore();
this.time = time;
this.damage = damage;
this.discs = build.getDiscIds();
this.potentials = build.getPotentials().clone();
this.notes = build.getSubNoteSkills().clone();
this.secondaryIds = build.getSecondarySkills().toIntArray();
this.characters = new ArrayList<>();
for (var charId : build.getCharIds()) {
@@ -184,6 +195,30 @@ public class JointDrillRankEntry implements GameDatabaseObject {
proto.addChars(c.toProto());
}
// Lazy way to add extra info.
// Discs, secondary ids, potentials, and notes were all added in the same update,
// so we don't need to null check each one individually.
if (this.getDiscs() != null) {
proto.addAllDiscs(this.getDiscs());
proto.addAllActiveSecondaryIds(this.getSecondaryIds());
for (var pot : this.getPotentials()) {
var info = BuildPotential.newInstance()
.setPotentialId(pot.getIntKey())
.setLevel(pot.getIntValue());
proto.addPotentials(info);
}
for (var note : this.getNotes()) {
var info = ItemTpl.newInstance()
.setTid(note.getIntKey())
.setQty(note.getIntValue());
proto.addNotes(info);
}
}
return proto;
}
}
@@ -12,7 +12,10 @@ import emu.nebula.database.GameDatabaseObject;
import emu.nebula.game.player.Player;
import emu.nebula.game.tower.StarTowerBuild;
import emu.nebula.game.character.GameCharacter;
import emu.nebula.game.inventory.ItemParamMap;
import emu.nebula.proto.Public.HonorInfo;
import emu.nebula.proto.Public.ItemTpl;
import emu.nebula.proto.PublicStarTower.BuildPotential;
import emu.nebula.proto.ScoreBossRank.ScoreBossRankChar;
import emu.nebula.proto.ScoreBossRank.ScoreBossRankData;
import emu.nebula.proto.ScoreBossRank.ScoreBossRankTeam;
@@ -184,6 +187,10 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
private int levelScore;
private int skillScore;
private List<ScoreBossCharEntry> characters;
private int[] discs;
private ItemParamMap potentials;
private ItemParamMap notes;
private int[] secondaryIds;
@Deprecated // Morphia only
public ScoreBossTeamEntry() {
@@ -196,6 +203,10 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
this.stars = stars;
this.levelScore = score;
this.skillScore = skillScore;
this.discs = build.getDiscIds();
this.potentials = build.getPotentials().clone();
this.notes = build.getSubNoteSkills().clone();
this.secondaryIds = build.getSecondarySkills().toIntArray();
this.characters = new ArrayList<>();
for (var charId : build.getCharIds()) {
@@ -215,6 +226,30 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
proto.addChars(c.toProto());
}
// Lazy way to add extra info.
// Discs, secondary ids, potentials, and notes were all added in the same update,
// so we don't need to null check each one individually.
if (this.getDiscs() != null) {
proto.addAllDiscs(this.getDiscs());
proto.addAllActiveSecondaryIds(this.getSecondaryIds());
for (var pot : this.getPotentials()) {
var info = BuildPotential.newInstance()
.setPotentialId(pot.getIntKey())
.setLevel(pot.getIntValue());
proto.addPotentials(info);
}
for (var note : this.getNotes()) {
var info = ItemTpl.newInstance()
.setTid(note.getIntKey())
.setQty(note.getIntValue());
proto.addNotes(info);
}
}
return proto;
}
}