diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-25 18:04:38 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-25 18:04:38 +0000 |
commit | c7e7b62aa94bf295ca1dc556762ad6070221e0cd (patch) | |
tree | 04f827df0df64a80e04a4115986609486d715237 /src/net/beinghandler.cpp | |
parent | c0c8775271679ac4904bc0bc02a74d28fc75efd0 (diff) | |
download | mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.gz mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.bz2 mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.xz mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.zip |
Switched client to use enet and modified login sequence to work with the new protocol from tmwserv.
Diffstat (limited to 'src/net/beinghandler.cpp')
-rw-r--r-- | src/net/beinghandler.cpp | 170 |
1 files changed, 84 insertions, 86 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index cd5653fc..68a46650 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -71,12 +71,12 @@ void BeingHandler::handleMessage(MessageIn *msg) case SMSG_BEING_VISIBLE: case SMSG_BEING_MOVE: // Information about a being in range - id = msg->readInt32(); - speed = msg->readInt16(); - msg->readInt16(); // unknown - msg->readInt16(); // unknown - msg->readInt16(); // option - job = msg->readInt16(); // class + id = msg->readLong(); + speed = msg->readShort(); + msg->readShort(); // unknown + msg->readShort(); // unknown + msg->readShort(); // option + job = msg->readShort(); // class dstBeing = beingManager->findBeing(id); @@ -104,33 +104,33 @@ void BeingHandler::handleMessage(MessageIn *msg) dstBeing->setWalkSpeed(speed); dstBeing->mJob = job; - dstBeing->setHairStyle(msg->readInt16()); - dstBeing->setWeapon(msg->readInt16()); - dstBeing->setVisibleEquipment(3, msg->readInt16()); // head bottom + dstBeing->setHairStyle(msg->readShort()); + dstBeing->setWeapon(msg->readShort()); + dstBeing->setVisibleEquipment(3, msg->readShort()); // head bottom if (msg->getId() == SMSG_BEING_MOVE) { - msg->readInt32(); // server tick + msg->readLong(); // server tick } - msg->readInt16(); // shield - dstBeing->setVisibleEquipment(4, msg->readInt16()); // head top - dstBeing->setVisibleEquipment(5, msg->readInt16()); // head mid - dstBeing->setHairColor(msg->readInt16()); - msg->readInt16(); // unknown - msg->readInt16(); // head dir - msg->readInt16(); // guild - msg->readInt16(); // unknown - msg->readInt16(); // unknown - msg->readInt16(); // manner - msg->readInt16(); // karma - msg->readInt8(); // unknown - dstBeing->setSex(1 - msg->readInt8()); // sex + msg->readShort(); // shield + dstBeing->setVisibleEquipment(4, msg->readShort()); // head top + dstBeing->setVisibleEquipment(5, msg->readShort()); // head mid + dstBeing->setHairColor(msg->readShort()); + msg->readShort(); // unknown + msg->readShort(); // head dir + msg->readShort(); // guild + msg->readShort(); // unknown + msg->readShort(); // unknown + msg->readShort(); // manner + msg->readShort(); // karma + msg->readByte(); // unknown + dstBeing->setSex(1 - msg->readByte()); // sex if (msg->getId() == SMSG_BEING_MOVE) { Uint16 srcX, srcY, dstX, dstY; - msg->readCoordinatePair(srcX, srcY, dstX, dstY); + //msg->readCoordinatePair(srcX, srcY, dstX, dstY); dstBeing->setAction(Being::STAND); dstBeing->mX = srcX; dstBeing->mY = srcY; @@ -138,23 +138,22 @@ void BeingHandler::handleMessage(MessageIn *msg) } else { - msg->readCoordinates(dstBeing->mX, dstBeing->mY, - dstBeing->mDirection); + //msg->readCoordinates(dstBeing->mX, dstBeing->mY, dstBeing->mDirection); } - msg->readInt8(); // unknown - msg->readInt8(); // unknown - msg->readInt8(); // unknown / sit + msg->readByte(); // unknown + msg->readByte(); // unknown + msg->readByte(); // unknown / sit break; case SMSG_BEING_REMOVE: // A being should be removed or has died - dstBeing = beingManager->findBeing(msg->readInt32()); + dstBeing = beingManager->findBeing(msg->readLong()); if (!dstBeing) break; - if (msg->readInt8() == 1) + if (msg->readByte() == 1) { // Death switch (dstBeing->getType()) @@ -182,15 +181,15 @@ void BeingHandler::handleMessage(MessageIn *msg) break; case SMSG_BEING_ACTION: - srcBeing = beingManager->findBeing(msg->readInt32()); - dstBeing = beingManager->findBeing(msg->readInt32()); - msg->readInt32(); // server tick - msg->readInt32(); // src speed - msg->readInt32(); // dst speed - param1 = msg->readInt16(); - msg->readInt16(); // param 2 - type = msg->readInt8(); - msg->readInt16(); // param 3 + srcBeing = beingManager->findBeing(msg->readLong()); + dstBeing = beingManager->findBeing(msg->readLong()); + msg->readLong(); // server tick + msg->readLong(); // src speed + msg->readLong(); // dst speed + param1 = msg->readShort(); + msg->readShort(); // param 2 + type = msg->readByte(); + msg->readShort(); // param 3 switch (type) { @@ -231,61 +230,61 @@ void BeingHandler::handleMessage(MessageIn *msg) break; case SMSG_BEING_LEVELUP: - if ((Uint32)msg->readInt32() == player_node->getId()) { + if ((Uint32)msg->readLong() == player_node->getId()) { logger->log("Level up"); sound.playSfx("sfx/levelup.ogg"); } else { logger->log("Someone else went level up"); } - msg->readInt32(); // type + msg->readLong(); // type break; case SMSG_BEING_EMOTION: - if (!(dstBeing = beingManager->findBeing(msg->readInt32()))) + if (!(dstBeing = beingManager->findBeing(msg->readLong()))) { break; } - dstBeing->mEmotion = msg->readInt8(); + dstBeing->mEmotion = msg->readByte(); dstBeing->mEmotionTime = EMOTION_TIME; break; case SMSG_BEING_CHANGE_LOOKS: { - if (!(dstBeing = beingManager->findBeing(msg->readInt32()))) + if (!(dstBeing = beingManager->findBeing(msg->readLong()))) { break; } - - int type = msg->readInt8(); + + int type = msg->readByte(); switch (type) { case 1: - dstBeing->setHairStyle(msg->readInt8()); + dstBeing->setHairStyle(msg->readByte()); break; case 2: - dstBeing->setWeapon(msg->readInt8()); + dstBeing->setWeapon(msg->readByte()); break; case 3: case 4: case 5: // Equip/unequip head 3. Bottom 4. Top 5. Middle - dstBeing->setVisibleEquipment(type, msg->readInt8()); + dstBeing->setVisibleEquipment(type, msg->readByte()); // First 3 slots of mVisibleEquipments are reserved for // later use, probably accessories. break; case 6: - dstBeing->setHairColor(msg->readInt8()); + dstBeing->setHairColor(msg->readByte()); break; default: - printf("c3: %i\n", msg->readInt8()); // unsupported + printf("c3: %i\n", msg->readByte()); // unsupported break; } } break; case SMSG_BEING_NAME_RESPONSE: - if ((dstBeing = beingManager->findBeing(msg->readInt32()))) + if ((dstBeing = beingManager->findBeing(msg->readLong()))) { dstBeing->setName(msg->readString(24)); } @@ -295,12 +294,12 @@ void BeingHandler::handleMessage(MessageIn *msg) case SMSG_PLAYER_UPDATE_2: case SMSG_PLAYER_MOVE: // An update about a player, potentially including movement. - id = msg->readInt32(); - speed = msg->readInt16(); - msg->readInt16(); // option 1 - msg->readInt16(); // option 2 - msg->readInt16(); // option - job = msg->readInt16(); + id = msg->readLong(); + speed = msg->readShort(); + msg->readShort(); // option 1 + msg->readShort(); // option 2 + msg->readShort(); // option + job = msg->readShort(); dstBeing = beingManager->findBeing(id); @@ -311,58 +310,57 @@ void BeingHandler::handleMessage(MessageIn *msg) dstBeing->setWalkSpeed(speed); dstBeing->mJob = job; - dstBeing->setHairStyle(msg->readInt16()); - dstBeing->setWeaponById(msg->readInt16()); // item id 1 - msg->readInt16(); // item id 2 - dstBeing->setVisibleEquipment(3, msg->readInt16()); // head bottom + dstBeing->setHairStyle(msg->readShort()); + dstBeing->setWeaponById(msg->readShort()); // item id 1 + msg->readShort(); // item id 2 + dstBeing->setVisibleEquipment(3, msg->readShort()); // head bottom if (msg->getId() == SMSG_PLAYER_MOVE) { - msg->readInt32(); // server tick + msg->readLong(); // server tick } - dstBeing->setVisibleEquipment(4, msg->readInt16()); // head top - dstBeing->setVisibleEquipment(5, msg->readInt16()); // head mid - dstBeing->setHairColor(msg->readInt16()); - msg->readInt16(); // unknown - msg->readInt16(); // head dir - msg->readInt32(); // guild - msg->readInt32(); // emblem - msg->readInt16(); // manner - msg->readInt8(); // karma - dstBeing->setSex(1 - msg->readInt8()); // sex + dstBeing->setVisibleEquipment(4, msg->readShort()); // head top + dstBeing->setVisibleEquipment(5, msg->readShort()); // head mid + dstBeing->setHairColor(msg->readShort()); + msg->readShort(); // unknown + msg->readShort(); // head dir + msg->readLong(); // guild + msg->readLong(); // emblem + msg->readShort(); // manner + msg->readByte(); // karma + dstBeing->setSex(1 - msg->readByte()); // sex if (msg->getId() == SMSG_PLAYER_MOVE) { Uint16 srcX, srcY, dstX, dstY; - msg->readCoordinatePair(srcX, srcY, dstX, dstY); + //msg->readCoordinatePair(srcX, srcY, dstX, dstY); dstBeing->mX = srcX; dstBeing->mY = srcY; dstBeing->setDestination(dstX, dstY); } else { - msg->readCoordinates(dstBeing->mX, dstBeing->mY, - dstBeing->mDirection); + //msg->readCoordinates(dstBeing->mX, dstBeing->mY, dstBeing->mDirection); } - msg->readInt8(); // unknown - msg->readInt8(); // unknown + msg->readByte(); // unknown + msg->readByte(); // unknown if (msg->getId() == SMSG_PLAYER_UPDATE_1) { - if (msg->readInt8() == 2) + if (msg->readByte() == 2) { dstBeing->setAction(Being::SIT); } } else if (msg->getId() == SMSG_PLAYER_MOVE) { - msg->readInt8(); // unknown + msg->readByte(); // unknown } - msg->readInt8(); // Lv - msg->readInt8(); // unknown + msg->readByte(); // Lv + msg->readByte(); // unknown dstBeing->mWalkTime = tick_time; dstBeing->mFrame = 0; @@ -370,9 +368,9 @@ void BeingHandler::handleMessage(MessageIn *msg) case 0x0119: // Change in players look - printf("0x0119 %i %i %i %x %i\n", msg->readInt32(), - msg->readInt16(), msg->readInt16(), msg->readInt16(), - msg->readInt8()); + printf("0x0119 %i %i %i %x %i\n", msg->readLong(), + msg->readShort(), msg->readShort(), msg->readShort(), + msg->readByte()); break; } } |