Show "none" for the database ID of unsaved mobs and NPCs in /info
Pets, guard and siege minions have no DB row and printed NO_DB_ROW_ASSIGNED_YET (2147483647). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
731425e85a
commit
49ad45d179
1 file changed
+11
-2
@@ -19,6 +19,7 @@ import engine.mbEnums.GameObjectType;
|
||||
import engine.mbEnums.TargetColor;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.StringUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -343,7 +344,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
|
||||
case NPC:
|
||||
NPC targetNPC = (NPC) target;
|
||||
output += "databaseID: " + targetNPC.getDBID() + newline;
|
||||
output += "databaseID: " + databaseIDText(targetNPC.getDBID()) + newline;
|
||||
output += "Name: " + targetNPC.getName();
|
||||
output += newline;
|
||||
output += StringUtils.addWS("Level: " + targetNPC.getLevel(), 20);
|
||||
@@ -414,7 +415,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
break;
|
||||
case Mob:
|
||||
Mob targetMob = (Mob) target;
|
||||
output += "databaseID: " + targetMob.getDBID() + newline;
|
||||
output += "databaseID: " + databaseIDText(targetMob.getDBID()) + newline;
|
||||
output += "Name: " + targetMob.getName();
|
||||
output += newline;
|
||||
output += StringUtils.addWS("Level: " + targetMob.getLevel(), 20);
|
||||
@@ -539,6 +540,14 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
throwbackInfo(pc, output);
|
||||
}
|
||||
|
||||
private static String databaseIDText(int databaseID) {
|
||||
|
||||
if (databaseID == MBServerStatics.NO_DB_ROW_ASSIGNED_YET)
|
||||
return "none";
|
||||
|
||||
return String.valueOf(databaseID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Gets information on an Object.";
|
||||
|
||||
Reference in new issue
Block a user