mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Implement trekker honor titles
- Setting affinity via commands will not add new honor titles
This commit is contained in:
@@ -11,9 +11,19 @@ public class AffinityLevelDef extends BaseDef {
|
||||
private int AffinityLevel;
|
||||
private int NeedExp;
|
||||
|
||||
@Getter
|
||||
private static transient int maxLevel;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return AffinityLevel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Calculate max affinity level
|
||||
if (this.AffinityLevel > maxLevel) {
|
||||
maxLevel = this.AffinityLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ public class CharacterDef extends BaseDef {
|
||||
|
||||
private int[] GemSlots;
|
||||
|
||||
// Cached data
|
||||
private transient CharacterDesDef des;
|
||||
private transient HonorDef honor;
|
||||
private transient ElementType elementType;
|
||||
private transient List<ChatDef> chats;
|
||||
|
||||
@@ -43,6 +45,10 @@ public class CharacterDef extends BaseDef {
|
||||
protected void setDes(CharacterDesDef des) {
|
||||
this.des = des;
|
||||
}
|
||||
|
||||
protected void setHonor(HonorDef honor) {
|
||||
this.honor = honor;
|
||||
}
|
||||
|
||||
public int getSkillsUpgradeGroup(int index) {
|
||||
if (index < 0 || index >= this.SkillsUpgradeGroup.length) {
|
||||
|
||||
@@ -1,36 +1,60 @@
|
||||
package emu.nebula.data.resources;
|
||||
|
||||
import emu.nebula.Nebula;
|
||||
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 = "Honor.json")
|
||||
@ResourceType(name = "Honor.json", loadPriority = LoadPriority.LOW)
|
||||
public class HonorDef extends BaseDef {
|
||||
private int Id;
|
||||
private int Type;
|
||||
private int[] Params;
|
||||
|
||||
private transient boolean valid;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
if (this.Type == 2) {
|
||||
if (this.Params.length < 1) {
|
||||
return false;
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Run AFTER character data has been loaded
|
||||
switch (this.Type) {
|
||||
case 1 -> {
|
||||
// Normal
|
||||
this.valid = true;
|
||||
}
|
||||
|
||||
int charId = this.Params[0];
|
||||
var charData = GameData.getCharacterDataTable().get(charId);
|
||||
|
||||
if (charData == null || !charData.isAvailable()) {
|
||||
return false;
|
||||
case 2 -> {
|
||||
// Character
|
||||
if (this.Params.length < 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
int charId = this.Params[0];
|
||||
var charData = GameData.getCharacterDataTable().get(charId);
|
||||
|
||||
if (charData == null || !charData.isAvailable()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Cache honor data for character data and set to valid
|
||||
charData.setHonor(this);
|
||||
this.valid = true;
|
||||
}
|
||||
case 3 -> {
|
||||
// Group
|
||||
this.valid = true;
|
||||
}
|
||||
default -> {
|
||||
// Unknown honor type
|
||||
Nebula.getLogger().warn("Honor " + this.getId() + " has an unknown type (" + this.getType() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user