diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-30 14:37:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-01 17:51:01 +0300 |
commit | c01aec243610016c2cd5e4211fee484627bc69ea (patch) | |
tree | 46a0b704701a9c1229fafa5e7ed7117002fc1579 /src/net | |
parent | 8321043b76660235a5ebbfbb8f43504f43c1af8b (diff) | |
download | manaverse-c01aec243610016c2cd5e4211fee484627bc69ea.tar.gz manaverse-c01aec243610016c2cd5e4211fee484627bc69ea.tar.bz2 manaverse-c01aec243610016c2cd5e4211fee484627bc69ea.tar.xz manaverse-c01aec243610016c2cd5e4211fee484627bc69ea.zip |
Add npc avatars for evol server.
Change protocol version to 6.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/messagein.cpp | 76 | ||||
-rw-r--r-- | src/net/messagein.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.h | 4 | ||||
-rw-r--r-- | src/net/tmwa/npchandler.cpp | 19 |
4 files changed, 55 insertions, 46 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 445b43d3f..0af0e389f 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -75,6 +75,39 @@ void MessageIn::readCoordinates(uint16_t &x, uint16_t &y) + toString(static_cast<int>(y))); } +uint8_t MessageIn::fromServerDirection(uint8_t serverDir) +{ + // Translate from eAthena format + switch (serverDir) + { + case 0: + return 1; + case 1: + return 3; + case 2: + return 2; + case 3: + return 6; + case 4: + return 4; + case 5: + return 12; + case 6: + return 8; + case 7: + return 9; + case 8: +#ifdef MANASERV_SUPPORT + if (Net::getNetworkType() != ServerInfo::MANASERV) +#endif + return 8; + default: + logger->log("incorrect direction: %d", + static_cast<int>(serverDir)); + return 0; + } +} + void MessageIn::readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction) { uint8_t serverDir = 0; @@ -89,48 +122,7 @@ void MessageIn::readCoordinates(uint16_t &x, uint16_t &y, uint8_t &direction) y = static_cast<unsigned short>(temp >> 4); serverDir = data[2] & 0x000f; - - // Translate from eAthena format - switch (serverDir) - { - case 0: - direction = 1; - break; - case 1: - direction = 3; - break; - case 2: - direction = 2; - break; - case 3: - direction = 6; - break; - case 4: - direction = 4; - break; - case 5: - direction = 12; - break; - case 6: - direction = 8; - break; - case 7: - direction = 9; - break; - case 8: -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - direction = 8; - break; - } - default: - logger->log("incorrect direction: %d", - static_cast<int>(direction)); - // OOPSIE! Impossible or unknown - direction = 0; - } + direction = fromServerDirection(serverDir); } mPos += 3; PacketCounters::incInBytes(3); diff --git a/src/net/messagein.h b/src/net/messagein.h index 00a92f49f..37caa7731 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.h @@ -101,6 +101,8 @@ class MessageIn virtual ~MessageIn() { } + static uint8_t fromServerDirection(uint8_t serverDir); + protected: /** * Constructor. diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 2dc91e509..03f24839b 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -39,8 +39,8 @@ * 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 6 +#define CLIENT_TMW_PROTOCOL_VERSION 1 namespace TmwAthena { diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index ec3ef48b8..be58f0bc5 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -290,10 +290,25 @@ void NpcHandler::processNpcCommand(Net::MessageIn &msg, int npcId) viewport->moveCameraRelative(x, y); } break; - case 5: + case 5: // close dialog closeDialog(npcId); break; - + case 6: // show avatar + if (mDialog) + mDialog->showAvatar(msg.readInt32()); // avatar id + break; + case 7: // set avatar direction + if (mDialog) + { + mDialog->setAvatarDirection( + Net::MessageIn::fromServerDirection( + msg.readInt32())); // direction + } + break; + case 8: // set avatar action + if (mDialog) + mDialog->setAvatarAction(msg.readInt32()); // direction + break; default: logger->log("unknown npc command: %d", cmd); break; |