Browse Source

Rebuild of ./createitem

combat-2
MagicBot 7 months ago
parent
commit
a7e953ac20
  1. 8
      src/engine/devcmd/cmds/CreateItemCmd.java

8
src/engine/devcmd/cmds/CreateItemCmd.java

@ -31,7 +31,6 @@ public class CreateItemCmd extends AbstractDevCmd {
@Override @Override
protected void _doCmd(PlayerCharacter playerCharacter, String[] words, protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
boolean worked = false;
if (words.length < 2) { if (words.length < 2) {
this.sendUsage(playerCharacter); this.sendUsage(playerCharacter);
@ -43,7 +42,6 @@ public class CreateItemCmd extends AbstractDevCmd {
if (template == null) if (template == null)
return; return;
;
int size = 1; int size = 1;
@ -51,7 +49,6 @@ public class CreateItemCmd extends AbstractDevCmd {
size = Integer.parseInt(words[1]); size = Integer.parseInt(words[1]);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
worked = false;
if (!playerCharacter.charItemManager.hasRoomInventory(template.item_wt)) { if (!playerCharacter.charItemManager.hasRoomInventory(template.item_wt)) {
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item."); ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
@ -65,13 +62,10 @@ public class CreateItemCmd extends AbstractDevCmd {
try { try {
item = DbManager.ItemQueries.PERSIST(item); item = DbManager.ItemQueries.PERSIST(item);
worked = true; playerCharacter.charItemManager.addItemToInventory(item);
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} }
if (worked) {
playerCharacter.charItemManager.addItemToInventory(item);
}
} }
playerCharacter.charItemManager.updateInventory(); playerCharacter.charItemManager.updateInventory();
} }

Loading…
Cancel
Save