summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-12 19:39:32 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-12 19:39:32 +0000
commit038388c2d1aeab8d653a8129e5ff95b4c83b2f88 (patch)
treeef09cb1870f60195fd316f4f5cf32c0d370035dd /src/net
parent12357db93c457675381c53caae226c900db07c8d (diff)
downloadmana-038388c2d1aeab8d653a8129e5ff95b4c83b2f88.tar.gz
mana-038388c2d1aeab8d653a8129e5ff95b4c83b2f88.tar.bz2
mana-038388c2d1aeab8d653a8129e5ff95b4c83b2f88.tar.xz
mana-038388c2d1aeab8d653a8129e5ff95b4c83b2f88.zip
Added support for visible equipment.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.cpp22
-rw-r--r--src/net/beinghandler.h1
-rw-r--r--src/net/protocol.h3
3 files changed, 25 insertions, 1 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index e88914ac..a6bc7fc3 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -60,6 +60,7 @@ BeingHandler::BeingHandler()
GPMSG_BEINGS_MOVE,
GPMSG_BEINGS_DAMAGE,
GPMSG_BEING_ACTION_CHANGE,
+ GPMSG_BEING_LOOKS_CHANGE,
0
};
handledMessages = _messages;
@@ -96,6 +97,9 @@ void BeingHandler::handleMessage(MessageIn &msg)
case GPMSG_BEING_ACTION_CHANGE:
handleBeingActionChangeMessage(msg);
break;
+ case GPMSG_BEING_LOOKS_CHANGE:
+ handleBeingLooksChangeMessage(msg);
+ break;
/*
case SMSG_BEING_VISIBLE:
@@ -411,6 +415,14 @@ void BeingHandler::handleMessage(MessageIn &msg)
}
}
+static void handleLooks(Being *being, MessageIn &msg)
+{
+ being->setWeapon(msg.readShort());
+ being->setVisibleEquipment(Being::HAT_SPRITE, msg.readShort());
+ being->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, msg.readShort());
+ being->setVisibleEquipment(Being::BOTTOMCLOTHES_SPRITE, msg.readShort());
+}
+
void
BeingHandler::handleBeingEnterMessage(MessageIn &msg)
{
@@ -443,7 +455,9 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg)
being->mY = py;
being->setDestination(px, py);
being->setAction(action);
+ handleLooks(being, msg);
} break;
+
case OBJECT_MONSTER:
{
int monsterId = msg.readShort();
@@ -546,3 +560,11 @@ void BeingHandler::handleBeingActionChangeMessage(MessageIn &msg)
being->setAction((Being::Action) msg.readByte());
}
+
+void BeingHandler::handleBeingLooksChangeMessage(MessageIn &msg)
+{
+ Being *being = beingManager->findBeing(msg.readShort());
+ if (!being) return;
+ handleLooks(being, msg);
+}
+
diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h
index 7a018950..d2a332a8 100644
--- a/src/net/beinghandler.h
+++ b/src/net/beinghandler.h
@@ -40,6 +40,7 @@ class BeingHandler : public MessageHandler
void handleBeingsMoveMessage(MessageIn &msg);
void handleBeingsDamageMessage(MessageIn &msg);
void handleBeingActionChangeMessage(MessageIn &msg);
+ void handleBeingLooksChangeMessage(MessageIn &msg);
};
#endif
diff --git a/src/net/protocol.h b/src/net/protocol.h
index b5dc2996..ba16e99d 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -163,10 +163,11 @@ enum {
GPMSG_INVENTORY_FULL = 0x0121, // { B slot, W item id [, B amount] }*
GPMSG_PLAYER_ATTRIBUTE_UPDATE = 0x0130, // { W attribute, W value }*
GPMSG_BEING_ENTER = 0x0200, // B type, W being id, B action, W*2 position
- // player: S name, B hair style, B hair color, B gender
+ // player: S name, B hair style, B hair color, B gender, W weapon, W hat, W top clothes, W bottom clothes
// monster: W type id
GPMSG_BEING_LEAVE = 0x0201, // W being id
GPMSG_ITEM_APPEAR = 0x0202, // W item id, W*2 position
+ GPMSG_BEING_LOOKS_CHANGE = 0x0210, // W weapon, W hat, W top clothes, W bottom clothes
PGMSG_WALK = 0x0260, // W*2 destination
PGMSG_ACTION_CHANGE = 0x0270, // B Action
GPMSG_BEING_ACTION_CHANGE = 0x0271, // W being id, B action