From d06f89e15bcc66a17e3475273341a50cfccdc07c Mon Sep 17 00:00:00 2001 From: "notzed@gmail.com" Date: Sun, 15 Sep 2013 00:12:36 +0000 Subject: [PATCH] Checkpoint of "work as is". git-svn-id: file:///home/notzed/svn/duskz/trunk@16 b8b59bfb-1aa4-4687-8f88-a62eeb14c21e --- DuskCommon/README | 1 + .../src/duskz/protocol/DuskProtocol.java | 19 ++++++++-- .../duskz/protocol/EntityUpdateMessage.java | 15 ++++++++ DuskCommon/src/duskz/protocol/Wearing.java | 35 ++++++++++++++++--- DuskCommon/src/duskz/util/Maths.java | 1 - 5 files changed, 63 insertions(+), 8 deletions(-) diff --git a/DuskCommon/README b/DuskCommon/README index 2df1b47..f4ae538 100644 --- a/DuskCommon/README +++ b/DuskCommon/README @@ -1,6 +1,7 @@ README ------ + This is a library containing some common utilities and classes betwen server and client. diff --git a/DuskCommon/src/duskz/protocol/DuskProtocol.java b/DuskCommon/src/duskz/protocol/DuskProtocol.java index 1dfb068..4b47f57 100644 --- a/DuskCommon/src/duskz/protocol/DuskProtocol.java +++ b/DuskCommon/src/duskz/protocol/DuskProtocol.java @@ -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 diff --git a/DuskCommon/src/duskz/protocol/EntityUpdateMessage.java b/DuskCommon/src/duskz/protocol/EntityUpdateMessage.java index d754b03..bffe728 100644 --- a/DuskCommon/src/duskz/protocol/EntityUpdateMessage.java +++ b/DuskCommon/src/duskz/protocol/EntityUpdateMessage.java @@ -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; diff --git a/DuskCommon/src/duskz/protocol/Wearing.java b/DuskCommon/src/duskz/protocol/Wearing.java index a86bb2b..ec5739f 100644 --- a/DuskCommon/src/duskz/protocol/Wearing.java +++ b/DuskCommon/src/duskz/protocol/Wearing.java @@ -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; + } } diff --git a/DuskCommon/src/duskz/util/Maths.java b/DuskCommon/src/duskz/util/Maths.java index 9bb6a3e..dc3e907 100644 --- a/DuskCommon/src/duskz/util/Maths.java +++ b/DuskCommon/src/duskz/util/Maths.java @@ -1,7 +1,6 @@ /* * This file is part of DuskZ, a graphical mud engine. * - * Copyright (C) 2000 Tom Weingarten * Copyright (C) 2013 Michael Zucchi * * DuskZ is free software; you can redistribute it and/or -- 2.39.2