From fdaec6534eb7ee902c75be3e4b732b6970abd859 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Thu, 7 Nov 2024 01:17:58 +0200 Subject: Made the server work with the adventure model * The model was imported from the wrong version, so that needs to be fixed. * The client side doesn't work at all right now. Use netcat for testing. * There are inconveniences and bugs in the model (eg. it lists the player among entities) * Players can just see each other, not interact in any way But it's a good base. --- src/main/scala/Model/Item.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/scala/Model/Item.scala (limited to 'src/main/scala/Model/Item.scala') diff --git a/src/main/scala/Model/Item.scala b/src/main/scala/Model/Item.scala new file mode 100644 index 0000000..3809561 --- /dev/null +++ b/src/main/scala/Model/Item.scala @@ -0,0 +1,18 @@ +package o1game.Model + +/** The class `Item` represents items in a text adventure game. Each item has a name + * and a longer description. (In later versions of the adventure game, items may + * have other features as well.) + * + * N.B. It is assumed, but not enforced by this class, that items have unique names. + * That is, no two items in a game world have the same name. + * + * @param name the item’s name + * @param description the item’s description */ +class Item(val name: String, val description: String): + + /** Returns a short textual representation of the item (its name, that is). */ + override def toString = this.name + +end Item + -- cgit v1.2.3