Files
Nebula/src/main/java/emu/nebula/data/resources/CharacterDesDef.java
Melledy 53839b48ca Implement !autobuild command
The `!autobuild` (or `!ab`) command allows you to build a record without needing to add every id. Missing trekkers/discs/potentials/melodies will be auto selected by the server.

Usage:
`!autobuild [character/disc/potential/melody ids...] lv[target record level] s[target record score]`

Examples:
`!autobuild s99999` = Creates a record with a random main trekker with the max score.
`!autobuild 103 lv30` = Creates a record with this trekker at record rank 30.
`!autobuild 155 132 107 s25000` = Creates a record with these trekkers with a record score of about 25000.
`!autobuild 103 510301 510302 510303 510304 lv20` = Creates a record with this trekker and these potentials at record rank 20.

Notes:
- Target level overrides target score. So a command of `!autobuild lv30 s1000` would have a record rank of 30 and NOT a score of 1000.
- If there is no target level or score, the command will default to a target level of 40.
- You can only add trekkers/discs that you own.
2025-12-20 04:20:34 -08:00

61 lines
1.5 KiB
Java

package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.GameData;
import emu.nebula.data.ResourceType;
import emu.nebula.data.ResourceType.LoadPriority;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import lombok.Getter;
@Getter
@ResourceType(name = "CharacterDes.json", loadPriority = LoadPriority.LOW)
public class CharacterDesDef extends BaseDef {
private int Id;
private IntOpenHashSet Tag;
private IntOpenHashSet PreferTags;
private IntOpenHashSet HateTags;
@Override
public int getId() {
return Id;
}
public boolean isPreferGift(AffinityGiftDef gift) {
if (this.getPreferTags() == null) {
return false;
}
for (int i = 0; i < gift.getTags().length; i++) {
int tag = gift.getTags()[i];
if (this.getPreferTags().contains(tag)) {
return true;
}
}
return false;
}
public boolean isHateGift(AffinityGiftDef gift) {
if (this.getHateTags() == null) {
return false;
}
for (int i = 0; i < gift.getTags().length; i++) {
int tag = gift.getTags()[i];
if (this.getHateTags().contains(tag)) {
return true;
}
}
return false;
}
@Override
public void onLoad() {
var character = GameData.getCharacterDataTable().get(this.getId());
if (character != null) {
character.setDes(this);
}
}
}