diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-17 01:03:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-17 01:03:34 +0300 |
commit | 5d77b00cba5398482c4eb9422ae4f06ae3509b8f (patch) | |
tree | ea8c4b6a012d4c9e27e227621197330f8fc2eacd /src/net/eathena/charserverhandler.cpp | |
parent | 0c5402def993b1df930cda7fcdaff4f865a84fdb (diff) | |
download | plus-5d77b00cba5398482c4eb9422ae4f06ae3509b8f.tar.gz plus-5d77b00cba5398482c4eb9422ae4f06ae3509b8f.tar.bz2 plus-5d77b00cba5398482c4eb9422ae4f06ae3509b8f.tar.xz plus-5d77b00cba5398482c4eb9422ae4f06ae3509b8f.zip |
Fix sending packets for version 20151001 and bigger.
Diffstat (limited to 'src/net/eathena/charserverhandler.cpp')
-rw-r--r-- | src/net/eathena/charserverhandler.cpp | 65 |
1 files changed, 51 insertions, 14 deletions
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 328546909..3eb355caa 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -38,6 +38,8 @@ #include "debug.h" extern Net::CharServerHandler *charServerHandler; +extern int packetVersion; +extern int serverVersion; namespace EAthena { @@ -80,23 +82,58 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, { createOutPacket(CMSG_CHAR_CREATE); outMsg.writeString(name, 24, "login"); - - outMsg.writeInt8(CAST_U8(slot), "slot"); - outMsg.writeInt16(CAST_S16(hairColor), "hair color"); - outMsg.writeInt16(CAST_S16(hairstyle), "hair style"); - if (serverFeatures->haveRaceSelection()) - outMsg.writeInt16(CAST_S16(race), "race"); - if (serverFeatures->haveCreateCharGender()) + if (serverVersion > 0) + { + outMsg.writeInt8(CAST_U8(slot), "slot"); + outMsg.writeInt16(CAST_S16(hairColor), "hair color"); + outMsg.writeInt16(CAST_S16(hairstyle), "hair style"); + if (serverFeatures->haveRaceSelection()) + outMsg.writeInt16(CAST_S16(race), "race"); + if (serverFeatures->haveCreateCharGender()) + { + uint8_t sex = 0; + if (gender == Gender::UNSPECIFIED) + sex = 99; + else + sex = Being::genderToInt(gender); + outMsg.writeInt8(sex, "gender"); + } + if (serverFeatures->haveLookSelection()) + outMsg.writeInt16(CAST_S16(look), "look"); + } + else { - uint8_t sex = 0; - if (gender == Gender::UNSPECIFIED) - sex = 99; + if (packetVersion >= 20151001) + { + outMsg.writeInt8(CAST_U8(slot), "slot"); + outMsg.writeInt16(CAST_S16(hairstyle), "hair style"); + outMsg.writeInt16(CAST_S16(0), "starting job id"); + outMsg.writeInt16(0, "unknown"); + outMsg.writeInt16(0, "unknown"); + uint8_t sex = 0; + if (gender == Gender::UNSPECIFIED) + sex = 99; + else + sex = Being::genderToInt(gender); + outMsg.writeInt8(sex, "gender"); + } + else if (packetVersion >= 20120307) + { + outMsg.writeInt8(CAST_U8(slot), "slot"); + outMsg.writeInt16(CAST_S16(hairstyle), "hair style"); + } else - sex = Being::genderToInt(gender); - outMsg.writeInt8(sex, "gender"); + { // < 20120307 + // +++ here need send stat points + // sending 5 for each stat for now + for (int i = 0; i < 6; i++) + outMsg.writeInt8(CAST_U8(5), "stat"); + + outMsg.writeInt8(CAST_U8(slot), "slot"); + outMsg.writeInt16(CAST_S16(hairColor), "hair color"); + outMsg.writeInt16(CAST_S16(hairstyle), "hair style"); + } } - if (serverFeatures->haveLookSelection()) - outMsg.writeInt16(CAST_S16(look), "look"); } void CharServerHandler::deleteCharacter(Net::Character *const character, |