diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-25 23:37:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-25 23:37:28 +0300 |
commit | 60757643df53ff5d9d6aa361486348bc6d4bf0f2 (patch) | |
tree | 13cf871ba389238ea8c8831f897b6b1135b0ba8e | |
parent | 32e6e1748c3aa26a55ce4f7281107c4334c80ef3 (diff) | |
download | mv-60757643df53ff5d9d6aa361486348bc6d4bf0f2.tar.gz mv-60757643df53ff5d9d6aa361486348bc6d4bf0f2.tar.bz2 mv-60757643df53ff5d9d6aa361486348bc6d4bf0f2.tar.xz mv-60757643df53ff5d9d6aa361486348bc6d4bf0f2.zip |
From eAthena netcode remove some evol packets implimentations.
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 47 | ||||
-rw-r--r-- | src/net/eathena/buysellhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.cpp | 77 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.cpp | 34 | ||||
-rw-r--r-- | src/net/eathena/network.h | 3 | ||||
-rw-r--r-- | src/net/eathena/npchandler.cpp | 18 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 69 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.h | 3 |
11 files changed, 48 insertions, 215 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index f7d2d3ea1..519681009 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -284,7 +284,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, bool look2) else { // SMSG_BEING_CHANGE_LOOKS2 id = msg.readInt16(); - if (type == 2 || serverVersion > 0) + if (type == 2) id2 = msg.readInt16(); else id2 = 1; @@ -525,19 +525,9 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) if (!config.getBoolValue("hideShield")) dstBeing->setSprite(SPRITE_SHIELD, shield); //dstBeing->setSprite(SPRITE_SHOE, shoes); - if (serverVersion > 0) - { - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, - "", colors[0]); - dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]); - dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]); - } - else - { - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); - dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); - dstBeing->setSprite(SPRITE_HAT, headTop); - } + dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); + dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); + dstBeing->setSprite(SPRITE_HAT, headTop); //dstBeing->setSprite(SPRITE_GLOVES, gloves); //dstBeing->setSprite(SPRITE_CAPE, cape); //dstBeing->setSprite(SPRITE_MISC1, misc1); @@ -758,23 +748,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) if (dstBeing->getType() == ActorSprite::MONSTER) { - if (serverVersion > 0) - { - int hp = msg.readInt32(); - int maxHP = msg.readInt32(); - if (hp && maxHP) - { - dstBeing->setMaxHP(maxHP); - int oldHP = dstBeing->getHP(); - if (!oldHP || oldHP > hp) - dstBeing->setHP(hp); - } - } - else - { - msg.readInt32(); - msg.readInt32(); - } + msg.readInt32(); + msg.readInt32(); gloves = 0; } else @@ -793,15 +768,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible) msg.readInt16(); // manner dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3 - if (serverVersion > 0 && dstBeing->getType() == ActorSprite::MONSTER) - { - int attackRange = msg.readInt8(); // karma - dstBeing->setAttackRange(attackRange); - } - else - { - msg.readInt8(); // karma - } + msg.readInt8(); // karma gender = msg.readInt8(); // reserving bits for future usage diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index 4526f226d..bc53daeff 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -106,8 +106,6 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) { msg.readInt16(); // length int sz = 11; - if (serverVersion > 0) - sz += 1; int n_items = (msg.getLength() - 4) / sz; mBuyDialog = new BuyDialog(mNpcId); mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY)); @@ -119,8 +117,6 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) msg.readInt8(); // type int itemId = msg.readInt16(); unsigned char color = 1; - if (serverVersion > 0) - color = msg.readInt8(); mBuyDialog->addItem(itemId, color, 0, value); } } diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 28288f244..c2c5f1ebf 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -164,8 +164,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) } void CharServerHandler::readPlayerData(Net::MessageIn &msg, - Net::Character *character, - bool withColors) + Net::Character *character, bool) { if (!character) return; @@ -226,44 +225,19 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, for (int i = 0; i < 6; i++) character->data.mStats[i + STR].base = msg.readInt8(); - if (withColors) - { - tempPlayer->setSprite(SPRITE_SHOE, shoes, "", msg.readInt8()); - tempPlayer->setSprite(SPRITE_GLOVES, gloves, "", msg.readInt8()); - tempPlayer->setSprite(SPRITE_CAPE, cape, "", msg.readInt8()); - tempPlayer->setSprite(SPRITE_MISC1, misc1, "", msg.readInt8()); - tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes, - "", msg.readInt8()); - //to avoid show error (error.xml) need remove this sprite - if (!config.getBoolValue("hideShield")) - tempPlayer->setSprite(SPRITE_SHIELD, shield, "", msg.readInt8()); - else - msg.readInt8(); - - tempPlayer->setSprite(SPRITE_HAT, hat, "", - msg.readInt8()); // head option top - tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes, "", - msg.readInt8()); - tempPlayer->setSprite(SPRITE_MISC2, misc2, "", msg.readInt8()); - msg.skip(5); - character->slot = msg.readInt8(); // character slot - } - else - { - tempPlayer->setSprite(SPRITE_SHOE, shoes); - tempPlayer->setSprite(SPRITE_GLOVES, gloves); - tempPlayer->setSprite(SPRITE_CAPE, cape); - tempPlayer->setSprite(SPRITE_MISC1, misc1); - tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes); - //to avoid show error (error.xml) need remove this sprite - if (!config.getBoolValue("hideShield")) - tempPlayer->setSprite(SPRITE_SHIELD, shield); - - tempPlayer->setSprite(SPRITE_HAT, hat); // head option top - tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes); - tempPlayer->setSprite(SPRITE_MISC2, misc2); - character->slot = msg.readInt8(); // character slot - } + tempPlayer->setSprite(SPRITE_SHOE, shoes); + tempPlayer->setSprite(SPRITE_GLOVES, gloves); + tempPlayer->setSprite(SPRITE_CAPE, cape); + tempPlayer->setSprite(SPRITE_MISC1, misc1); + tempPlayer->setSprite(SPRITE_BOTTOMCLOTHES, bottomClothes); + //to avoid show error (error.xml) need remove this sprite + if (!config.getBoolValue("hideShield")) + tempPlayer->setSprite(SPRITE_SHIELD, shield); + + tempPlayer->setSprite(SPRITE_HAT, hat); // head option top + tempPlayer->setSprite(SPRITE_TOPCLOTHES, topClothes); + tempPlayer->setSprite(SPRITE_MISC2, misc2); + character->slot = msg.readInt8(); // character slot msg.readInt8(); // unknown } @@ -282,7 +256,8 @@ void CharServerHandler::chooseCharacter(Net::Character *character) void CharServerHandler::newCharacter(const std::string &name, int slot, bool gender A_UNUSED, int hairstyle, - int hairColor, unsigned char race, + int hairColor, + unsigned char race A_UNUSED, const std::vector<int> &stats) { MessageOut outMsg(CMSG_CHAR_CREATE); @@ -293,8 +268,6 @@ void CharServerHandler::newCharacter(const std::string &name, int slot, outMsg.writeInt8(static_cast<unsigned char>(slot)); outMsg.writeInt16(static_cast<short>(hairColor)); outMsg.writeInt16(static_cast<short>(hairstyle)); - if (serverVersion >= 2) - outMsg.writeInt8(race); } void CharServerHandler::deleteCharacter(Net::Character *character) @@ -330,12 +303,7 @@ void CharServerHandler::connect() outMsg.writeInt32(token.account_ID); outMsg.writeInt32(token.session_ID1); outMsg.writeInt32(token.session_ID2); - // [Fate] The next word is unused by the old char server, so we squeeze in - // mana client version information - if (serverVersion > 0) - outMsg.writeInt16(CLIENT_PROTOCOL_VERSION); - else - outMsg.writeInt16(CLIENT_TMW_PROTOCOL_VERSION); + outMsg.writeInt16(CLIENT_PROTOCOL_VERSION); outMsg.writeInt8(Being::genderToInt(token.sex)); // We get 4 useless bytes before the real answer comes in (what are these?) @@ -349,23 +317,18 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) if (slots > 0 && slots < 30) loginData.characterSlots = static_cast<short unsigned int>(slots); - bool version = msg.readInt8() == 1 && serverVersion > 0; - msg.skip(17); // 0 Unused + msg.skip(18); // 0 Unused delete_all(mCharacters); mCharacters.clear(); // Derive number of characters from message length - int count = (msg.getLength() - 24); - if (version) - count /= 120; - else - count /= 106; + int count = (msg.getLength() - 24) / 106; for (int i = 0; i < count; ++i) { Net::Character *character = new Net::Character; - readPlayerData(msg, character, version); + readPlayerData(msg, character, false); mCharacters.push_back(character); if (character && character->dummy) { diff --git a/src/net/eathena/charserverhandler.h b/src/net/eathena/charserverhandler.h index a264156cf..28b43cba5 100644 --- a/src/net/eathena/charserverhandler.h +++ b/src/net/eathena/charserverhandler.h @@ -65,7 +65,7 @@ class CharServerHandler : public MessageHandler, public Ea::CharServerHandler protected: void readPlayerData(Net::MessageIn &msg, Net::Character *character, - bool withColors); + bool); }; } // namespace EAthena diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 7b287e6e7..3fce80ad2 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -304,4 +304,8 @@ void GeneralHandler::processEvent(Channels channel, } } +void GeneralHandler::requestOnlineList() +{ +} + } // namespace EAthena diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h index 9855be47e..4c7965c4a 100644 --- a/src/net/eathena/generalhandler.h +++ b/src/net/eathena/generalhandler.h @@ -57,6 +57,8 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void reloadPartially(); + void requestOnlineList(); + protected: MessageHandlerPtr mAdminHandler; MessageHandlerPtr mBeingHandler; diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 0ddc64a7b..68555d7c5 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -159,31 +159,15 @@ void LoginHandler::requestUpdateHosts() void LoginHandler::processServerVersion(Net::MessageIn &msg) { - char b1 = msg.readInt8(); // -1 - char b2 = msg.readInt8(); // E - char b3 = msg.readInt8(); // V - char b4 = msg.readInt8(); // L - if (b1 == -1 && b2 == 'E' && b3 == 'V' && b4 == 'L') - { - unsigned int options = msg.readInt8(); - mRegistrationEnabled = options; - msg.skip(2); // 0 unused - serverVersion = msg.readInt8(); - if (serverVersion >= 5) - requestUpdateHosts(); - } - else - { - unsigned int options = msg.readInt32(); - mRegistrationEnabled = options; - serverVersion = 0; - } - logger->log("Server version: %d", serverVersion); - if (serverVersion < 5) - { - if (Client::getState() != STATE_LOGIN) - Client::setState(STATE_LOGIN); - } + msg.readInt8(); + msg.readInt8(); + msg.readInt8(); + msg.readInt8(); + msg.readInt32(); + mRegistrationEnabled = true; + serverVersion = 0; + if (Client::getState() != STATE_LOGIN) + Client::setState(STATE_LOGIN); // Leave this last mVersionResponse = true; diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 82e8fcc88..4a7f41c09 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -39,8 +39,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 5 -#define CLIENT_TMW_PROTOCOL_VERSION 1 +#define CLIENT_PROTOCOL_VERSION 1 namespace EAthena { diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 53b7d0b03..5562c51bf 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -54,7 +54,6 @@ NpcHandler::NpcHandler() SMSG_NPC_CLOSE, SMSG_NPC_INT_INPUT, SMSG_NPC_STR_INPUT, - SMSG_NPC_COMMAND, SMSG_NPC_CUTIN, SMSG_NPC_VIEWPOINT, 0 @@ -185,20 +184,9 @@ void NpcHandler::buyItem(int beingId A_UNUSED, int itemId, unsigned char color, int amount) { MessageOut outMsg(CMSG_NPC_BUY_REQUEST); - if (serverVersion > 0) - { - outMsg.writeInt16(10); // One item (length of packet) - outMsg.writeInt16(static_cast<int16_t>(amount)); - outMsg.writeInt16(static_cast<int16_t>(itemId)); - outMsg.writeInt8(color); - outMsg.writeInt8(0); - } - else - { - outMsg.writeInt16(8); // One item (length of packet) - outMsg.writeInt16(static_cast<int16_t>(amount)); - outMsg.writeInt16(static_cast<int16_t>(itemId)); - } + outMsg.writeInt16(8); // One item (length of packet) + outMsg.writeInt16(static_cast<int16_t>(amount)); + outMsg.writeInt16(static_cast<int16_t>(itemId)); } void NpcHandler::sellItem(int beingId A_UNUSED, int itemId, int amount) diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index a96df306d..dfce8812c 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -54,7 +54,6 @@ PlayerHandler::PlayerHandler() SMSG_PLAYER_STAT_UPDATE_5, SMSG_PLAYER_STAT_UPDATE_6, SMSG_PLAYER_ARROW_MESSAGE, - SMSG_ONLINE_LIST, SMSG_PLAYER_SHORTCUTS, SMSG_PLAYER_SHOW_EQUIP, 0 @@ -104,10 +103,6 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) processPlayerArrowMessage(msg); break; - case SMSG_ONLINE_LIST: - processOnlineList(msg); - break; - case SMSG_PLAYER_SHORTCUTS: processPlayerShortcuts(msg); break; @@ -222,70 +217,6 @@ void PlayerHandler::respawn() void PlayerHandler::requestOnlineList() { - MessageOut outMsg(CMSG_ONLINE_LIST); -} - -void PlayerHandler::processOnlineList(Net::MessageIn &msg) -{ - if (!whoIsOnline) - return; - - int size = msg.readInt16() - 4; - std::vector<OnlinePlayer*> arr; - - if (!size) - { - if (whoIsOnline) - whoIsOnline->loadList(arr); - return; - } - - char *start = reinterpret_cast<char*>(msg.readBytes(size)); - if (!start) - return; - - char *buf = start; - - int addVal = 1; - if (serverVersion >= 4) - addVal = 3; - - while (buf - start + 1 < size && *(buf + addVal)) - { - unsigned char status = 255; - unsigned char ver = 0; - unsigned char level = 0; - if (serverVersion >= 4) - { - status = *buf; - buf ++; - level = *buf; - buf ++; - ver = *buf; - } - buf ++; - - int gender = GENDER_UNSPECIFIED; - if (serverVersion >= 4) - { - if (config.getBoolValue("showgender")) - { - if (status & Being::FLAG_GENDER_MALE) - gender = GENDER_MALE; - else if (status & Being::FLAG_GENDER_OTHER) - gender = GENDER_OTHER; - else - gender = GENDER_FEMALE; - } - } - arr.push_back(new OnlinePlayer(static_cast<char*>(buf), - status, level, gender, ver)); - buf += strlen(buf) + 1; - } - - if (whoIsOnline) - whoIsOnline->loadList(arr); - delete [] start; } void PlayerHandler::updateStatus(uint8_t status) diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h index 9b0ba215c..a6d5be102 100644 --- a/src/net/eathena/playerhandler.h +++ b/src/net/eathena/playerhandler.h @@ -51,13 +51,12 @@ class PlayerHandler : public MessageHandler, public Ea::PlayerHandler void setDirection(char direction); void setDestination(int x, int y, int direction = -1); void changeAction(Being::Action action); - void processOnlineList(Net::MessageIn &msg); - void requestOnlineList(); void updateStatus(uint8_t status); void processPlayerShortcuts(Net::MessageIn &msg); void processPlayerShowEquip(Net::MessageIn &msg); + void requestOnlineList(); void respawn(); }; |