summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.cpp40
-rw-r--r--src/net/protocol.h14
2 files changed, 40 insertions, 14 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 59a4fa9a..e3eb6eba 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -397,24 +397,36 @@ void BeingHandler::handleMessage(MessageIn &msg)
void
BeingHandler::handleBeingEnterMessage(MessageIn &msg)
{
- msg.readByte(); // type
+ int type = msg.readByte(); // type
int id = msg.readLong();
- std::string name = msg.readString();
- Being *being;
- if (player_node->getName() == name)
+
+ switch (type) {
+ case OBJECT_PLAYER:
{
- being = player_node;
- being->setId(id);
- }
- else
+ std::string name = msg.readString();
+ Being *being;
+ if (player_node->getName() == name)
+ {
+ being = player_node;
+ being->setId(id);
+ }
+ else
+ {
+ being = beingManager->createBeing(id, 0);
+ being->setName(name);
+ }
+ being->setHairStyle(msg.readByte());
+ being->setHairColor(msg.readByte());
+ being->setSex(msg.readByte());
+ } break;
+ case OBJECT_MONSTER:
{
- // assume type is player for now, so job 0, TODO
- being = beingManager->createBeing(id, 0);
- being->setName(name);
+ int monsterId = msg.readShort();
+ Being *being;
+ being = beingManager->createBeing(id, 1002 + monsterId);
+ being->setWalkSpeed(150); // TODO
+ } break;
}
- being->setHairStyle(msg.readByte());
- being->setHairColor(msg.readByte());
- being->setSex(msg.readByte());
}
void BeingHandler::handleBeingLeaveMessage(MessageIn &msg)
diff --git a/src/net/protocol.h b/src/net/protocol.h
index d99351f2..6feee9d4 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -223,4 +223,18 @@ enum {
CREATE_TOO_MUCH_CHARACTERS
};
+// Object type enumeration
+enum {
+ // A simple item
+ OBJECT_ITEM = 0,
+ // An item that can be activated (doors, switchs, sign, ...)
+ OBJECT_ACTOR,
+ // Non-Playable-Character is an actor capable of movement and maybe actions
+ OBJECT_NPC,
+ // A monster (moving actor with AI. able to toggle map/quest actions, too)
+ OBJECT_MONSTER,
+ // A player
+ OBJECT_PLAYER
+};
+
#endif