Fix !build command potential count and not saving to the database

This commit is contained in:
Melledy
2025-12-10 20:38:05 -08:00
parent 3a6387c2bd
commit 5d9ff6e1af
2 changed files with 10 additions and 9 deletions

View File

@@ -62,6 +62,9 @@ public class BuildCommand implements CommandHandler {
// Add to star tower manager
target.getStarTowerManager().getBuilds().put(build.getUid(), build);
// Save to database
build.save();
// Send package to player
target.addNextPackage(NetMsgId.st_import_build_notify, build.toProto());

View File

@@ -76,13 +76,6 @@ public class StarTowerBuild implements GameDatabaseObject {
// Add to potential map
this.getPotentials().put(id, level);
// Add to character
var potentialData = GameData.getPotentialDataTable().get(id);
if (potentialData != null) {
int charId = potentialData.getCharId();
this.getCharPots().add(charId, level);
}
}
// Add sub note skills
@@ -131,15 +124,20 @@ public class StarTowerBuild implements GameDatabaseObject {
// Score
public int calculateScore() {
// Clear score
// Clear
this.score = 0;
this.getCharPots().clear();
// Add score from potentials
for (var potential : this.getPotentials().int2IntEntrySet()) {
for (var potential : this.getPotentials()) {
var data = GameData.getPotentialDataTable().get(potential.getIntKey());
if (data == null) continue;
// Add score
this.score += data.getBuildScore(potential.getIntValue());
// Add for character potential count
this.getCharPots().add(data.getCharId(), potential.getIntValue());
}
// Add score from sub note skills