From 23c4d7012568277b7985f1b1e633c4b8242f9ddd Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sat, 3 May 2014 18:28:43 +0200 Subject: Add missing inventory weight printing --- src/esieequest/controller/commands/InventoryCommand.java | 2 +- src/esieequest/model/Player.java | 9 +++++++++ src/esieequest/model/Text.java | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/esieequest/controller/commands/InventoryCommand.java b/src/esieequest/controller/commands/InventoryCommand.java index ff7a341..0f95ead 100644 --- a/src/esieequest/controller/commands/InventoryCommand.java +++ b/src/esieequest/controller/commands/InventoryCommand.java @@ -13,7 +13,7 @@ public class InventoryCommand implements Executable { @Override public void execute(final String argument, final Game game, final Viewable view) { - view.echo(game.getPlayer().listItemsNamesString()); + view.echo(game.getPlayer().listItemsNamesString() + game.getPlayer().getWeightString()); } diff --git a/src/esieequest/model/Player.java b/src/esieequest/model/Player.java index 3851c44..4060367 100644 --- a/src/esieequest/model/Player.java +++ b/src/esieequest/model/Player.java @@ -295,4 +295,13 @@ public class Player { return this.nbSteps == this.nbStepsLimit; } + /** + * Returns informations about the Player's inventory weight. + * + * @return informations about the Player's inventory weight + */ + public String getWeightString() { + return Text.INVENTORY_WEIGHT_PREFIX.getText() + this.getItemsWeight() + Text.INVENTORY_WEIGHT_SUFFIX.getText(); + } + } diff --git a/src/esieequest/model/Text.java b/src/esieequest/model/Text.java index 7a9bd49..283ccab 100644 --- a/src/esieequest/model/Text.java +++ b/src/esieequest/model/Text.java @@ -48,7 +48,10 @@ public enum Text { DIRECTION_SUFFIX("."), INVENTORY_PREFIX("Items: "), - INVENTORY_SUFFIX("."), + INVENTORY_SUFFIX(". "), + + INVENTORY_WEIGHT_PREFIX("Total inventory weight: "), + INVENTORY_WEIGHT_SUFFIX("."), // formatting LIST_SEPARATOR(", "), -- cgit v1.2.3