Checkpoint of "work as is".
authornotzed@gmail.com <notzed@gmail.com@b8b59bfb-1aa4-4687-8f88-a62eeb14c21e>
Sun, 15 Sep 2013 00:12:36 +0000 (00:12 +0000)
committernotzed@gmail.com <notzed@gmail.com@b8b59bfb-1aa4-4687-8f88-a62eeb14c21e>
Sun, 15 Sep 2013 00:12:36 +0000 (00:12 +0000)
git-svn-id: file:///home/notzed/svn/duskz/trunk@16 b8b59bfb-1aa4-4687-8f88-a62eeb14c21e

DuskCommon/README
DuskCommon/src/duskz/protocol/DuskProtocol.java
DuskCommon/src/duskz/protocol/EntityUpdateMessage.java
DuskCommon/src/duskz/protocol/Wearing.java
DuskCommon/src/duskz/util/Maths.java

index 2df1b47..f4ae538 100644 (file)
@@ -1,6 +1,7 @@
 
 README
 ------
+
 This is a library containing some common utilities and classes betwen
 server and client.
 
index 1dfb068..4b47f57 100644 (file)
@@ -80,7 +80,7 @@ public interface DuskProtocol {
         * ListMessage
         * int FIELD_MAP_WIDTH
         * int FIELD_MAP_HEIGHT
-        * TODO: merge this with other init stuff like images
+        * String FIELD_MAP_ASSETLOCATION rcname
         */
        public final static int MSG_INIT_MAP = 5;
        /**
@@ -109,7 +109,7 @@ public interface DuskProtocol {
         */
        public final static int MSG_REMOVE_ENTITY = 10;
        /**
-        * ByteMessage
+        * ByteEntityMessage
         * Value is cardinal direction as byte (nsew)
         */
        public final static int MSG_MOVE = 11;
@@ -270,11 +270,26 @@ public interface DuskProtocol {
        /**
         * Entity update fields
         */
+       /**
+        * IntMessage: flags
+        * bitfield 01: 1 = enemy, 2 = ally
+        * big 2: sleeping
+        */
        public final static int FIELD_ENTITY_FLAGS = 0;
+       /**
+        * StringListMessage conditions
+        */
+       public final static int FIELD_ENTITY_CONDITIONS = 1;
+       public final static int ENTITY_FLAG_ALLY = 1;
+       public final static int ENTITY_FLAG_ENEMY = 2;
+       // not sure if this should show up in the condition list
+       public final static int ENTITY_FLAG_SLEEPING = 4;
        /**
         * Player update fields
         * MSG_INFO_PLAYER
         * MSG_INFO_PET
+        *
+        * FIXME: these fields should match the STAT_* constants
         */
        /**
         * IntegerMessage
index d754b03..bffe728 100644 (file)
@@ -30,6 +30,21 @@ import java.io.IOException;
  */
 public class EntityUpdateMessage extends DuskMessage.EntityMessage {
 
+       // This need to be kept in sync with Thing
+       public static final int TYPE_PLAYER = 0;
+       public static final int TYPE_PET = 1;
+       public static final int TYPE_MOBILE = 2;
+       public static final int TYPE_SIGN = 3;
+       public static final int TYPE_PROP = 4;
+       public static final int TYPE_GAME_SHOP = 5;
+       public static final int TYPE_PLAYER_SHOP = 6;
+       public static final int TYPE_ITEM = 7;
+       public static final int TYPE_FOOD = 8;
+       public static final int TYPE_DRINK = 9;
+       public static final int TYPE_WEAPON = 10;
+       public static final int TYPE_ARMOUR = 11;
+       public static final int TYPE_CONTAINER = 12;
+       
        public String entityName;
        public byte entityType;
        public short x;
index a86bb2b..ec5739f 100644 (file)
@@ -27,7 +27,7 @@ package duskz.protocol;
  *
  * @author notzed
  */
-public interface Wearing {
+public class Wearing {
 
        /**
         * Non-wearable item
@@ -69,14 +69,39 @@ public interface Wearing {
         * Gloves
         */
        public static final int HANDS = 8;
+       //
        public static final int WEARING_COUNT = 9;
-       public static final String[] titles = {
+       public static final String[] wornTitles = {
                "Wielded", "Arms", "Legs", "Torso", "Waist", "Neck", "Skull", "Eyes", "Hands"
        };
        /**
-        * Field names as on the server
+        * Field wornNames as on the server
         */
-       public static final String[] names = {
-               "wielded", "arms", "legs", "torso", "waist", "neck", "skull", "eyes", "hands"
+       public static final String[] wornNames = {
+               "wield", "arms", "legs", "torso", "waist", "neck", "skull", "eyes", "hands"
        };
+
+       public static int getCode(String name) {
+               switch (name) {
+                       case "wield":
+                               return WIELD;
+                       case "arms":
+                               return ARMS;
+                       case "legs":
+                               return LEGS;
+                       case "torso":
+                               return TORSO;
+                       case "waist":
+                               return WAIST;
+                       case "neck":
+                               return NECK;
+                       case "skull":
+                               return SKULL;
+                       case "eyes":
+                               return EYES;
+                       case "hands":
+                               return HANDS;
+               }
+               return INVENTORY;
+       }
 }
index 9bb6a3e..dc3e907 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * This file is part of DuskZ, a graphical mud engine.
  *
- * Copyright (C) 2000 Tom Weingarten <captaint@home.com>
  * Copyright (C) 2013 Michael Zucchi <notzed@gmail.com>
  *
  * DuskZ is free software; you can redistribute it and/or