summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-10 13:12:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-10 13:12:47 +0300
commitdfe0fc16bfbe2f2c36d2adad884c28f89625c285 (patch)
treed4c7420f490198f51344201f5eced24f0f8cf513 /src/net/tmwa
parent173c48498dc55e9b86bee009427fb5ae58cd9821 (diff)
downloadmanaverse-dfe0fc16bfbe2f2c36d2adad884c28f89625c285.tar.gz
manaverse-dfe0fc16bfbe2f2c36d2adad884c28f89625c285.tar.bz2
manaverse-dfe0fc16bfbe2f2c36d2adad884c28f89625c285.tar.xz
manaverse-dfe0fc16bfbe2f2c36d2adad884c28f89625c285.zip
Split processBeingChangeLook for each packet type.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beinghandler.cpp62
-rw-r--r--src/net/tmwa/beinghandler.h2
2 files changed, 63 insertions, 1 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 5338cd4c3..c592c7bf0 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -156,10 +156,13 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_BEING_CHANGE_LOOKS:
- case SMSG_BEING_CHANGE_LOOKS2:
processBeingChangeLook(msg);
break;
+ case SMSG_BEING_CHANGE_LOOKS2:
+ processBeingChangeLook2(msg);
+ break;
+
case SMSG_BEING_NAME_RESPONSE:
processNameResponse(msg);
break;
@@ -302,6 +305,63 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const
BLOCK_END("BeingHandler::processBeingChangeLook")
}
+void BeingHandler::processBeingChangeLook2(Net::MessageIn &msg) const
+{
+ BLOCK_START("BeingHandler::processBeingChangeLook")
+ if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeLook")
+ return;
+ }
+
+ /*
+ * SMSG_BEING_CHANGE_LOOKS (0x00c3) and
+ * SMSG_BEING_CHANGE_LOOKS2 (0x01d7) do basically the same
+ * thing. The difference is that ...LOOKS carries a single
+ * 8 bit value, where ...LOOKS2 carries two 16 bit values.
+ *
+ * If type = 2, then the first 16 bit value is the weapon ID,
+ * and the second 16 bit value is the shield ID. If no
+ * shield is equipped, or type is not 2, then the second
+ * 16 bit value will be 0.
+ */
+
+ Being *const dstBeing = actorManager->findBeing(
+ msg.readInt32("being id"));
+
+ const uint8_t type = msg.readUInt8("type");
+ int16_t id = 0;
+ int id2 = 0;
+ const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2;
+
+ if (!look2)
+ {
+ id = static_cast<int16_t>(msg.readUInt8("id"));
+ id2 = 1; // default color
+ }
+ else
+ { // SMSG_BEING_CHANGE_LOOKS2
+ id = msg.readInt16("id1");
+ if (type == 2 || serverVersion > 0)
+ {
+ id2 = msg.readInt16("id2");
+ }
+ else
+ {
+ msg.readInt16("id2");
+ id2 = 1;
+ }
+ }
+
+ if (!localPlayer || !dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeLook")
+ return;
+ }
+ processBeingChangeLookContinue(dstBeing, type, id, id2);
+ BLOCK_END("BeingHandler::processBeingChangeLook")
+}
+
void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing,
const uint8_t type,
const int id,
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 4f2d75f0c..996b054ba 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -48,6 +48,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
protected:
void processBeingChangeLook(Net::MessageIn &msg) const;
+ void processBeingChangeLook2(Net::MessageIn &msg) const;
+
void processBeingVisible(Net::MessageIn &msg);
void processBeingMove(Net::MessageIn &msg);