mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-19 17:19:58 +02:00
Implement honor affinity levels for leaderboards
This commit is contained in:
@@ -20,6 +20,14 @@ public class HonorDef extends BaseDef {
|
|||||||
public int getId() {
|
public int getId() {
|
||||||
return Id;
|
return Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCharacterHonor() {
|
||||||
|
return this.Type == 2 && this.Params.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCharacterId() {
|
||||||
|
return this.Params[0];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
|
|||||||
@@ -300,8 +300,8 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
|
|||||||
if (honor == null) return false;
|
if (honor == null) return false;
|
||||||
|
|
||||||
// Check if honor title is a trekker affinity title
|
// Check if honor title is a trekker affinity title
|
||||||
if (honor.getType() == 2 && honor.getParams().length >= 1) {
|
if (honor.isCharacterHonor()) {
|
||||||
int charId = honor.getParams()[0];
|
int charId = honor.getCharacterId();
|
||||||
var character = this.getPlayer().getCharacters().getCharacterById(charId);
|
var character = this.getPlayer().getCharacters().getCharacterById(charId);
|
||||||
|
|
||||||
if (character != null && character.getAffinityLevel() >= GameConstants.AFFINITY_HONOR_UNLOCK_LEVEL) {
|
if (character != null && character.getAffinityLevel() >= GameConstants.AFFINITY_HONOR_UNLOCK_LEVEL) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
import dev.morphia.annotations.Entity;
|
||||||
import dev.morphia.annotations.Id;
|
import dev.morphia.annotations.Id;
|
||||||
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.database.GameDatabaseObject;
|
import emu.nebula.database.GameDatabaseObject;
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.tower.StarTowerBuild;
|
import emu.nebula.game.tower.StarTowerBuild;
|
||||||
@@ -31,6 +31,7 @@ public class JointDrillRankEntry implements GameDatabaseObject {
|
|||||||
private int titlePrefix;
|
private int titlePrefix;
|
||||||
private int titleSuffix;
|
private int titleSuffix;
|
||||||
private int[] honor;
|
private int[] honor;
|
||||||
|
private int[] honorAff;
|
||||||
private int score;
|
private int score;
|
||||||
private IntSet claimedRewards;
|
private IntSet claimedRewards;
|
||||||
|
|
||||||
@@ -66,6 +67,19 @@ public class JointDrillRankEntry implements GameDatabaseObject {
|
|||||||
this.titlePrefix = player.getTitlePrefix();
|
this.titlePrefix = player.getTitlePrefix();
|
||||||
this.titleSuffix = player.getTitleSuffix();
|
this.titleSuffix = player.getTitleSuffix();
|
||||||
this.honor = player.getHonor();
|
this.honor = player.getHonor();
|
||||||
|
this.honorAff = new int[this.honor.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < this.honor.length; i++) {
|
||||||
|
var honor = GameData.getHonorDataTable().get(this.honor[i]);
|
||||||
|
if (honor == null || !honor.isCharacterHonor()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var character = player.getCharacters().getCharacterById(honor.getCharacterId());
|
||||||
|
if (character != null) {
|
||||||
|
this.honorAff[i] = character.getAffinityLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void settle(Player player, List<JointDrillBuild> builds, int activityId, int score) {
|
public void settle(Player player, List<JointDrillBuild> builds, int activityId, int score) {
|
||||||
@@ -107,8 +121,19 @@ public class JointDrillRankEntry implements GameDatabaseObject {
|
|||||||
.setTitleSuffix(this.getTitleSuffix())
|
.setTitleSuffix(this.getTitleSuffix())
|
||||||
.setRank(this.getRank());
|
.setRank(this.getRank());
|
||||||
|
|
||||||
for (int id : this.getHonor()) {
|
for (int i = 0; i < this.getHonor().length; i++) {
|
||||||
proto.addHonors(HonorInfo.newInstance().setId(id));
|
int honorId = this.getHonor()[i];
|
||||||
|
int affinityLevel = 0;
|
||||||
|
|
||||||
|
if (this.getHonorAff() != null && i < this.getHonorAff().length) {
|
||||||
|
affinityLevel = this.getHonorAff()[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
var info = HonorInfo.newInstance()
|
||||||
|
.setId(honorId)
|
||||||
|
.setAffinityLV(affinityLevel);
|
||||||
|
|
||||||
|
proto.addHonors(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var team : this.getTeams()) {
|
for (var team : this.getTeams()) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
import dev.morphia.annotations.Entity;
|
||||||
import dev.morphia.annotations.Id;
|
import dev.morphia.annotations.Id;
|
||||||
|
import emu.nebula.data.GameData;
|
||||||
import emu.nebula.database.GameDatabaseObject;
|
import emu.nebula.database.GameDatabaseObject;
|
||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.tower.StarTowerBuild;
|
import emu.nebula.game.tower.StarTowerBuild;
|
||||||
@@ -33,6 +33,7 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
|||||||
private int titlePrefix;
|
private int titlePrefix;
|
||||||
private int titleSuffix;
|
private int titleSuffix;
|
||||||
private int[] honor;
|
private int[] honor;
|
||||||
|
private int[] honorAff;
|
||||||
private int score;
|
private int score;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private int stars;
|
private int stars;
|
||||||
@@ -81,6 +82,19 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
|||||||
this.titlePrefix = player.getTitlePrefix();
|
this.titlePrefix = player.getTitlePrefix();
|
||||||
this.titleSuffix = player.getTitleSuffix();
|
this.titleSuffix = player.getTitleSuffix();
|
||||||
this.honor = player.getHonor();
|
this.honor = player.getHonor();
|
||||||
|
this.honorAff = new int[this.honor.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < this.honor.length; i++) {
|
||||||
|
var honor = GameData.getHonorDataTable().get(this.honor[i]);
|
||||||
|
if (honor == null || !honor.isCharacterHonor()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var character = player.getCharacters().getCharacterById(honor.getCharacterId());
|
||||||
|
if (character != null) {
|
||||||
|
this.honorAff[i] = character.getAffinityLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void settle(Player player, StarTowerBuild build, int controlId, int level, int stars, int score, int skillScore) {
|
public void settle(Player player, StarTowerBuild build, int controlId, int level, int stars, int score, int skillScore) {
|
||||||
@@ -129,8 +143,19 @@ public class ScoreBossRankEntry implements GameDatabaseObject {
|
|||||||
.setTitleSuffix(this.getTitleSuffix())
|
.setTitleSuffix(this.getTitleSuffix())
|
||||||
.setRank(this.getRank());
|
.setRank(this.getRank());
|
||||||
|
|
||||||
for (int id : this.getHonor()) {
|
for (int i = 0; i < this.getHonor().length; i++) {
|
||||||
proto.addHonors(HonorInfo.newInstance().setId(id));
|
int honorId = this.getHonor()[i];
|
||||||
|
int affinityLevel = 0;
|
||||||
|
|
||||||
|
if (this.getHonorAff() != null && i < this.getHonorAff().length) {
|
||||||
|
affinityLevel = this.getHonorAff()[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
var info = HonorInfo.newInstance()
|
||||||
|
.setId(honorId)
|
||||||
|
.setAffinityLV(affinityLevel);
|
||||||
|
|
||||||
|
proto.addHonors(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var entry : this.getTeams().entrySet()) {
|
for (var entry : this.getTeams().entrySet()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user