From 5d9ff6e1affdacdfe0ea5e37aeac3e22232f8b76 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Wed, 10 Dec 2025 20:38:05 -0800 Subject: [PATCH] Fix `!build` command potential count and not saving to the database --- .../nebula/command/commands/BuildCommand.java | 3 +++ .../emu/nebula/game/tower/StarTowerBuild.java | 16 +++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/emu/nebula/command/commands/BuildCommand.java b/src/main/java/emu/nebula/command/commands/BuildCommand.java index 89377bb..5efee74 100644 --- a/src/main/java/emu/nebula/command/commands/BuildCommand.java +++ b/src/main/java/emu/nebula/command/commands/BuildCommand.java @@ -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()); diff --git a/src/main/java/emu/nebula/game/tower/StarTowerBuild.java b/src/main/java/emu/nebula/game/tower/StarTowerBuild.java index 698ced2..7a09da8 100644 --- a/src/main/java/emu/nebula/game/tower/StarTowerBuild.java +++ b/src/main/java/emu/nebula/game/tower/StarTowerBuild.java @@ -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