mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 20:34:36 +01:00
Fix !build command potential count and not saving to the database
This commit is contained in:
@@ -62,6 +62,9 @@ public class BuildCommand implements CommandHandler {
|
|||||||
// Add to star tower manager
|
// Add to star tower manager
|
||||||
target.getStarTowerManager().getBuilds().put(build.getUid(), build);
|
target.getStarTowerManager().getBuilds().put(build.getUid(), build);
|
||||||
|
|
||||||
|
// Save to database
|
||||||
|
build.save();
|
||||||
|
|
||||||
// Send package to player
|
// Send package to player
|
||||||
target.addNextPackage(NetMsgId.st_import_build_notify, build.toProto());
|
target.addNextPackage(NetMsgId.st_import_build_notify, build.toProto());
|
||||||
|
|
||||||
|
|||||||
@@ -76,13 +76,6 @@ public class StarTowerBuild implements GameDatabaseObject {
|
|||||||
|
|
||||||
// Add to potential map
|
// Add to potential map
|
||||||
this.getPotentials().put(id, level);
|
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
|
// Add sub note skills
|
||||||
@@ -131,15 +124,20 @@ public class StarTowerBuild implements GameDatabaseObject {
|
|||||||
// Score
|
// Score
|
||||||
|
|
||||||
public int calculateScore() {
|
public int calculateScore() {
|
||||||
// Clear score
|
// Clear
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
|
this.getCharPots().clear();
|
||||||
|
|
||||||
// Add score from potentials
|
// Add score from potentials
|
||||||
for (var potential : this.getPotentials().int2IntEntrySet()) {
|
for (var potential : this.getPotentials()) {
|
||||||
var data = GameData.getPotentialDataTable().get(potential.getIntKey());
|
var data = GameData.getPotentialDataTable().get(potential.getIntKey());
|
||||||
if (data == null) continue;
|
if (data == null) continue;
|
||||||
|
|
||||||
|
// Add score
|
||||||
this.score += data.getBuildScore(potential.getIntValue());
|
this.score += data.getBuildScore(potential.getIntValue());
|
||||||
|
|
||||||
|
// Add for character potential count
|
||||||
|
this.getCharPots().add(data.getCharId(), potential.getIntValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add score from sub note skills
|
// Add score from sub note skills
|
||||||
|
|||||||
Reference in New Issue
Block a user