diff --git a/java/src/game/gui/GuiChar.java b/java/src/game/gui/GuiChar.java index 0a53ec7..8f93fac 100755 --- a/java/src/game/gui/GuiChar.java +++ b/java/src/game/gui/GuiChar.java @@ -419,17 +419,22 @@ public class GuiChar extends GuiList } }, "Spieler-Größe", "cm")).enabled = this.gm.thePlayer == null || this.gm.thePlayer.getMinSize() != this.gm.thePlayer.getMaxSize(); this.add(new Label(width / 2 - 200, 36, 400, 20, "Name", true)); + final Textbox descField = this.add(new Textbox(width - 396, height - 384, 392, 160, Player.MAX_INFO_LENGTH, new Textbox.Callback() { + public void use(Textbox elem, Action value) { + } + }, "")); this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { if(GuiChar.this.gm.thePlayer != null) { GuiChar.this.gm.waitForServer(); Dimension dim = // GuiChar.this.dimension == Integer.MAX_VALUE ? Space.INSTANCE : UniverseRegistry.getBaseDimensions().get(GuiChar.this.dimension); + GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText())); GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, dim.getDimensionId())); } } }, "Charakter erstellen")); - Textbox nameField = this.add(new Textbox(width / 2 - 200, 36 + 20, 400, 24, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() { + this.add(new Textbox(width / 2 - 200, 36 + 20, 400, 24, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() { public void use(Textbox elem, Action value) { if(value == Action.SEND || value == Action.UNFOCUS) { String name = elem.getText(); @@ -458,7 +463,7 @@ public class GuiChar extends GuiList } } } - this.dimButton = this.add(new ActButton(width - 396, height - 300, 392, 24, new ActButton.Callback() { + this.dimButton = this.add(new ActButton(width - 396, height - 220, 392, 24, new ActButton.Callback() { public void use(ActButton elem, Mode mode) { if(mode == Mode.TERTIARY) { GuiChar.this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size()); @@ -479,7 +484,7 @@ public class GuiChar extends GuiList GuiChar.this.setDimButton(); } }, "")); - this.descLines = this.add(new TransparentBox(width - 396, height - 300 + 24, 392, 160, "", false)); + this.descLines = this.add(new TransparentBox(width - 396, height - 220 + 24, 392, 76, "", false)); this.setDimButton(); } diff --git a/java/src/game/network/Player.java b/java/src/game/network/Player.java index 833b878..38b7a23 100755 --- a/java/src/game/network/Player.java +++ b/java/src/game/network/Player.java @@ -1958,7 +1958,7 @@ public class Player extends NetHandler implements ICrafting, Executor } CPacketMessage.Type type = packetIn.getType(); - if(this.charEditor != (type == CPacketMessage.Type.DISPLAY)) + if(this.charEditor != (type == CPacketMessage.Type.DISPLAY || type == CPacketMessage.Type.INFO)) return; switch(type) { @@ -1978,6 +1978,12 @@ public class Player extends NetHandler implements ICrafting, Executor this.entity.setCustomNameTag(msg); break; + case INFO: + if(msg.length() > MAX_INFO_LENGTH) + throw new IllegalArgumentException("Ungültige Beschreibung"); + this.entity.setDescription(msg.isEmpty() ? null : msg); + break; + // case ITEM: // if(this.entity.openContainer instanceof ContainerRepair) // ((ContainerRepair)this.entity.openContainer).updateItemName(msg); diff --git a/java/src/game/packet/CPacketMessage.java b/java/src/game/packet/CPacketMessage.java index 112ca24..037f27e 100755 --- a/java/src/game/packet/CPacketMessage.java +++ b/java/src/game/packet/CPacketMessage.java @@ -49,7 +49,11 @@ public class CPacketMessage implements Packet } public static enum Type { - COMMAND(Player.MAX_CMD_LENGTH), CHAT(Player.MAX_CMD_LENGTH), DISPLAY(Player.MAX_NICK_LENGTH); // , ITEM(30); + COMMAND(Player.MAX_CMD_LENGTH), + CHAT(Player.MAX_CMD_LENGTH), + DISPLAY(Player.MAX_NICK_LENGTH), + INFO(Player.MAX_INFO_LENGTH); + // , ITEM(30); private final int length;