summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/beinghandler.cpp48
-rw-r--r--src/net/eathena/beinghandler.h2
2 files changed, 49 insertions, 1 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 91a467bbf..315d3a47b 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -163,10 +163,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;
@@ -310,6 +313,49 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg) const
processBeingChangeLookContinue(dstBeing, type, id, id2);
}
+void BeingHandler::processBeingChangeLook2(Net::MessageIn &msg) const
+{
+ if (!actorManager)
+ 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");
+ int id = 0;
+ unsigned int id2 = 0U;
+ const bool look2 = msg.getId() == SMSG_BEING_CHANGE_LOOKS2;
+
+ if (!look2)
+ {
+ id = static_cast<int>(msg.readUInt8("id"));
+ id2 = 1U; // default color
+ }
+ else
+ { // SMSG_BEING_CHANGE_LOOKS2
+ id = msg.readInt16("id1");
+ id2 = msg.readInt16("id2");
+ if (type != 2)
+ id2 = 1;
+ }
+
+ if (!localPlayer || !dstBeing)
+ return;
+
+ processBeingChangeLookContinue(dstBeing, type, id, id2);
+}
+
void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing,
const uint8_t type,
const int id,
diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h
index 0d4c71a77..2ddd60d6a 100644
--- a/src/net/eathena/beinghandler.h
+++ b/src/net/eathena/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);