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.
This commit is contained in:
Melledy
2025-12-20 04:20:34 -08:00
parent b5fde4433d
commit 53839b48ca
7 changed files with 537 additions and 75 deletions
@@ -2,6 +2,8 @@ package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@Getter
@@ -19,4 +21,31 @@ public class CharPotentialDef extends BaseDef {
public int getId() {
return Id;
}
public IntList getPotentialList(boolean main, boolean special) {
// Create list
var list = new IntArrayList();
//
if (main) {
if (special) {
list.addElements(0, this.getMasterSpecificPotentialIds());
} else {
list.addElements(0, this.getMasterNormalPotentialIds());
}
} else {
if (special) {
list.addElements(0, this.getAssistSpecificPotentialIds());
} else {
list.addElements(0, this.getAssistNormalPotentialIds());
}
}
if (!special) {
list.addElements(0, this.getCommonPotentialIds());
}
// Complete
return list;
}
}
@@ -11,7 +11,7 @@ import lombok.Getter;
@ResourceType(name = "CharacterDes.json", loadPriority = LoadPriority.LOW)
public class CharacterDesDef extends BaseDef {
private int Id;
private int[] Tag;
private IntOpenHashSet Tag;
private IntOpenHashSet PreferTags;
private IntOpenHashSet HateTags;
@@ -22,14 +22,14 @@ public class PotentialDef extends BaseDef {
return Id;
}
public boolean isRare() {
public boolean isSpecial() {
return this.BranchType != 3;
}
public int getMaxLevel() {
// Check if regular potential
if (this.BranchType == 3) {
return this.BuildScore.length;
return 6;
}
// Special potential should always have a max level of 1