aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-05-18 17:53:00 +0200
committerPacien TRAN-GIRARD2014-05-18 17:53:00 +0200
commitdb373254f918ef75062698757e6cd6e13e26289f (patch)
treee1975b38b06c88f469f3f3e2e0d9cf515778f9f1
parent0d4651e54f40f4dad929c419e92e37a15926f7be (diff)
downloadesieequest-db373254f918ef75062698757e6cd6e13e26289f.tar.gz
Format code (100 chars line)
-rw-r--r--src/esieequest/controller/commands/BackCommand.java4
-rw-r--r--src/esieequest/controller/commands/Command.java3
-rw-r--r--src/esieequest/controller/commands/DropCommand.java4
-rw-r--r--src/esieequest/controller/commands/GoCommand.java3
-rw-r--r--src/esieequest/controller/commands/InventoryCommand.java3
-rw-r--r--src/esieequest/controller/commands/LoadCommand.java10
-rw-r--r--src/esieequest/controller/commands/LookCommand.java4
-rw-r--r--src/esieequest/controller/commands/NewCommand.java4
-rw-r--r--src/esieequest/controller/commands/TakeCommand.java7
-rw-r--r--src/esieequest/controller/commands/TurnCommand.java3
-rw-r--r--src/esieequest/controller/utils/EnumUtils.java9
-rw-r--r--src/esieequest/controller/utils/ListUtils.java3
-rw-r--r--src/esieequest/model/Game.java4
-rw-r--r--src/esieequest/model/Player.java9
-rw-r--r--src/esieequest/model/characters/MovingCharacter.java3
-rw-r--r--src/esieequest/model/items/Inventory.java7
-rw-r--r--src/esieequest/model/map/Room.java11
-rw-r--r--src/esieequest/view/Viewable.java3
-rw-r--r--src/esieequest/view/app/UserInterface.java20
-rw-r--r--src/esieequest/view/text/TextInterface.java3
-rw-r--r--src/esieequest/view/web/WebInterface.java17
-rw-r--r--src/org/json/simple/JSONArray.java3
-rw-r--r--src/org/json/simple/JSONObject.java3
-rw-r--r--src/org/json/simple/JSONValue.java4
-rw-r--r--src/org/json/simple/parser/JSONParser.java39
-rw-r--r--src/org/json/simple/parser/ParseException.java9
-rw-r--r--src/org/json/simple/parser/Yylex.java68
-rw-r--r--src/rejava/io/StringReader.java3
28 files changed, 189 insertions, 74 deletions
diff --git a/src/esieequest/controller/commands/BackCommand.java b/src/esieequest/controller/commands/BackCommand.java
index 847d396..d7ed8a3 100644
--- a/src/esieequest/controller/commands/BackCommand.java
+++ b/src/esieequest/controller/commands/BackCommand.java
@@ -15,7 +15,9 @@ public class BackCommand implements Executable {
15 15
16 game.getPlayer().goToPreviousRoom(); 16 game.getPlayer().goToPreviousRoom();
17 17
18 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); 18 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer()
19 .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer()
20 .canGoBack());
19 21
20 } 22 }
21 23
diff --git a/src/esieequest/controller/commands/Command.java b/src/esieequest/controller/commands/Command.java
index ca8909c..0879bef 100644
--- a/src/esieequest/controller/commands/Command.java
+++ b/src/esieequest/controller/commands/Command.java
@@ -94,7 +94,8 @@ public enum Command {
94 * @return a String listing all the names of the Command-s 94 * @return a String listing all the names of the Command-s
95 */ 95 */
96 public static String listCommandsNamesString() { 96 public static String listCommandsNamesString() {
97 return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.toString(), null, Text.HELP_SUFFIX.toString()); 97 return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.toString(),
98 null, Text.HELP_SUFFIX.toString());
98 } 99 }
99 100
100} 101}
diff --git a/src/esieequest/controller/commands/DropCommand.java b/src/esieequest/controller/commands/DropCommand.java
index ee71b1e..dbdf03c 100644
--- a/src/esieequest/controller/commands/DropCommand.java
+++ b/src/esieequest/controller/commands/DropCommand.java
@@ -31,7 +31,9 @@ public class DropCommand implements Executable {
31 final Item item = game.getPlayer().getInventory().takeItem(itemName); 31 final Item item = game.getPlayer().getInventory().takeItem(itemName);
32 game.getPlayer().getCurrentSide().getInventory().putItem(item); 32 game.getPlayer().getCurrentSide().getInventory().putItem(item);
33 33
34 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); 34 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer()
35 .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer()
36 .canGoBack());
35 view.updateInventory(game.getPlayer().getInventory()); 37 view.updateInventory(game.getPlayer().getInventory());
36 38
37 } 39 }
diff --git a/src/esieequest/controller/commands/GoCommand.java b/src/esieequest/controller/commands/GoCommand.java
index 136379f..1078d49 100644
--- a/src/esieequest/controller/commands/GoCommand.java
+++ b/src/esieequest/controller/commands/GoCommand.java
@@ -39,7 +39,8 @@ public class GoCommand implements Executable {
39 return; 39 return;
40 } 40 }
41 41
42 view.updateLocation(game.getPlayer().getCurrentRoom(), direction, game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); 42 view.updateLocation(game.getPlayer().getCurrentRoom(), direction, game.getPlayer()
43 .getCurrentSide(), game.getPlayer().canGoBack());
43 44
44 // handle challenge mode 45 // handle challenge mode
45 if (game.getPlayer().walk()) { 46 if (game.getPlayer().walk()) {
diff --git a/src/esieequest/controller/commands/InventoryCommand.java b/src/esieequest/controller/commands/InventoryCommand.java
index a6ce080..27936ce 100644
--- a/src/esieequest/controller/commands/InventoryCommand.java
+++ b/src/esieequest/controller/commands/InventoryCommand.java
@@ -13,7 +13,8 @@ public class InventoryCommand implements Executable {
13 @Override 13 @Override
14 public void execute(final String argument, final Game game, final Viewable view) { 14 public void execute(final String argument, final Game game, final Viewable view) {
15 15
16 view.echo(game.getPlayer().getInventory().listItemsNamesString() + game.getPlayer().getInventory().getWeightString()); 16 view.echo(game.getPlayer().getInventory().listItemsNamesString()
17 + game.getPlayer().getInventory().getWeightString());
17 18
18 } 19 }
19 20
diff --git a/src/esieequest/controller/commands/LoadCommand.java b/src/esieequest/controller/commands/LoadCommand.java
index 8a69544..896d85b 100644
--- a/src/esieequest/controller/commands/LoadCommand.java
+++ b/src/esieequest/controller/commands/LoadCommand.java
@@ -24,7 +24,8 @@ public class LoadCommand implements Executable {
24 try { 24 try {
25 datas = (JSONObject) JSONValue.parseWithException(jsonString); 25 datas = (JSONObject) JSONValue.parseWithException(jsonString);
26 } catch (final ParseException e) { 26 } catch (final ParseException e) {
27 view.echo(Text.PARSING_ERROR_PREFIX.toString() + e.getMessage() + Text.PARSING_ERROR_SUFFIX.toString()); 27 view.echo(Text.PARSING_ERROR_PREFIX.toString() + e.getMessage()
28 + Text.PARSING_ERROR_SUFFIX.toString());
28 return; 29 return;
29 } 30 }
30 31
@@ -32,14 +33,17 @@ public class LoadCommand implements Executable {
32 game.newGame(false, false); 33 game.newGame(false, false);
33 game.deserialise(datas); 34 game.deserialise(datas);
34 } catch (final Exception e) { 35 } catch (final Exception e) {
35 view.echo(Text.DESERIALISING_ERROR_PREFIX.toString() + e.getMessage() + Text.DESERIALISING_ERROR_SUFFIX.toString()); 36 view.echo(Text.DESERIALISING_ERROR_PREFIX.toString() + e.getMessage()
37 + Text.DESERIALISING_ERROR_SUFFIX.toString());
36 e.printStackTrace(); 38 e.printStackTrace();
37 return; 39 return;
38 } 40 }
39 41
40 // view.updateQuest(); 42 // view.updateQuest();
41 // view.updateInventory(game.getPlayer().getItems()); 43 // view.updateInventory(game.getPlayer().getItems());
42 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); 44 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer()
45 .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer()
46 .canGoBack());
43 47
44 } 48 }
45 49
diff --git a/src/esieequest/controller/commands/LookCommand.java b/src/esieequest/controller/commands/LookCommand.java
index ece4ddc..305934f 100644
--- a/src/esieequest/controller/commands/LookCommand.java
+++ b/src/esieequest/controller/commands/LookCommand.java
@@ -21,7 +21,9 @@ public class LookCommand implements Executable {
21 final ArrayList<String> informations = new ArrayList<String>(); 21 final ArrayList<String> informations = new ArrayList<String>();
22 22
23 informations.add(game.getPlayer().getCurrentRoom().getInformations()); 23 informations.add(game.getPlayer().getCurrentRoom().getInformations());
24 informations.add(Text.DIRECTION_PREFIX + game.getPlayer().getCurrentDirection().name().toLowerCase() + Text.DIRECTION_SUFFIX); 24 informations.add(Text.DIRECTION_PREFIX
25 + game.getPlayer().getCurrentDirection().name().toLowerCase()
26 + Text.DIRECTION_SUFFIX);
25 27
26 view.echo(Joiner.on(Text.NEW_LINE.toString()).join(informations)); 28 view.echo(Joiner.on(Text.NEW_LINE.toString()).join(informations));
27 29
diff --git a/src/esieequest/controller/commands/NewCommand.java b/src/esieequest/controller/commands/NewCommand.java
index e0e45ab..3f0b4b9 100644
--- a/src/esieequest/controller/commands/NewCommand.java
+++ b/src/esieequest/controller/commands/NewCommand.java
@@ -24,7 +24,9 @@ public class NewCommand implements Executable {
24 24
25 view.enable(); 25 view.enable();
26 26
27 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer().getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer().canGoBack()); 27 view.updateLocation(game.getPlayer().getCurrentRoom(), game.getPlayer()
28 .getCurrentDirection(), game.getPlayer().getCurrentSide(), game.getPlayer()
29 .canGoBack());
28 view.echo(Text.WELCOME.toString()); 30 view.echo(Text.WELCOME.toString());
29 31
30 } 32 }
diff --git a/src/esieequest/controller/commands/TakeCommand.java b/src/esieequest/controller/commands/TakeCommand.java
index b92f4e5..9f70f98 100644
--- a/src/esieequest/controller/commands/TakeCommand.java
+++ b/src/esieequest/controller/commands/TakeCommand.java
@@ -38,7 +38,8 @@ public class TakeCommand implements Executable {
38 38
39 // handle inventory weight limit 39 // handle inventory weight limit
40 final int maximumWeight = game.getPlayer().getInventoryWeightLimit(); 40 final int maximumWeight = game.getPlayer().getInventoryWeightLimit();
41 final int futureWeight = game.getPlayer().getInventory().getTotalWeight() + item.getWeight(); 41 final int futureWeight = game.getPlayer().getInventory().getTotalWeight()
42 + item.getWeight();
42 if (futureWeight > maximumWeight) { 43 if (futureWeight > maximumWeight) {
43 view.echo(Text.INVENTORY_FULL.toString()); 44 view.echo(Text.INVENTORY_FULL.toString());
44 return; 45 return;
@@ -47,7 +48,9 @@ public class TakeCommand implements Executable {
47 game.getPlayer().getCurrentRoom().removeItem(item); 48 game.getPlayer().getCurrentRoom().removeItem(item);