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
@@ -421,7 +421,7 @@ public class StarTowerGame {
this.getPotentials().put(id, nextLevel);
// Add to rare potential count
if (potentialData.isRare()) {
if (potentialData.isSpecial()) {
this.getRarePotentialCount().add(potentialData.getCharId(), 1);
}
@@ -574,46 +574,26 @@ public class StarTowerGame {
/**
* Creates a potential selector for the specified character
*/
public StarTowerPotentialCase createPotentialSelector(int charId, boolean rare) {
public StarTowerPotentialCase createPotentialSelector(int charId, boolean special) {
// Check character id
if (charId <= 0) {
charId = this.getRandomCharId();
}
// Make sure character can't have more than 2 rare potentials
if (rare && this.getRarePotentialCount(charId) >= 2) {
if (special && this.getRarePotentialCount(charId) >= 2) {
return null;
}
// Get character potentials
var data = GameData.getCharPotentialDataTable().get(charId);
if (data == null) {
return null;
}
// Random potentials list
var list = new IntArrayList();
// Add potentials based on character role
boolean isMainCharacter = this.getCharIds()[0] == charId;
if (isMainCharacter) {
if (rare) {
list.addElements(0, data.getMasterSpecificPotentialIds());
} else {
list.addElements(0, data.getMasterNormalPotentialIds());
}
} else {
if (rare) {
list.addElements(0, data.getAssistSpecificPotentialIds());
} else {
list.addElements(0, data.getAssistNormalPotentialIds());
}
}
if (!rare) {
list.addElements(0, data.getCommonPotentialIds());
}
var list = data.getPotentialList(this.getCharIds()[0] == charId, special);
// Remove potentials we already have maxed out
var potentials = new IntArrayList();
@@ -674,7 +654,7 @@ public class StarTowerGame {
}
// Creator potential selector case
if (rare) {
if (special) {
return new StarTowerSelectSpecialPotentialCase(this, charId, selector);
} else {
return new StarTowerPotentialCase(this, charId, selector);