diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-27 20:54:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-27 20:54:14 +0300 |
commit | a86a068c3a5d97377deee915c93c5a29889f1a59 (patch) | |
tree | 63790d35acc1656808d60f1efb76a964f7d5e654 /src | |
parent | 9d583528aefbbdcfac9e6027aa162153cd5b6a05 (diff) | |
download | manaplus-a86a068c3a5d97377deee915c93c5a29889f1a59.tar.gz manaplus-a86a068c3a5d97377deee915c93c5a29889f1a59.tar.bz2 manaplus-a86a068c3a5d97377deee915c93c5a29889f1a59.tar.xz manaplus-a86a068c3a5d97377deee915c93c5a29889f1a59.zip |
Add packet SMSG_PLAYER_KILLED_BY 0x0b1d.
Change protocol version to 17.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/net/eathena/network.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 1 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 30 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.h | 1 | ||||
-rw-r--r-- | src/net/eathena/serverfeatures.cpp | 5 | ||||
-rw-r--r-- | src/net/tmwa/serverfeatures.cpp | 5 |
7 files changed, 44 insertions, 3 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 33cf120d2..a5aa8b5e9 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -381,7 +381,8 @@ void LocalPlayer::setAction(const BeingActionT &action, { if (action == BeingAction::DEAD) { - if (!mLastHitFrom.empty()) + if (!mLastHitFrom.empty() && + !serverFeatures->haveKillerId()) { // TRANSLATORS: chat message after death debugMsg(strprintf(_("You were killed by %s."), diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 0b628256f..7b737bdec 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -29,7 +29,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 16 +#define CLIENT_PROTOCOL_VERSION 17 namespace EAthena { diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index bba0e64e7..affdc4b81 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -799,6 +799,7 @@ if (serverVersion > 0) packet(SMSG_BATTLE_EMBLEM2, 0x0b1a, 34, &BattleGroundRecv::processBattleEmblem2, 0); packet(SMSG_MAP_SET_TILES_TYPE, 0x0b1b, 34, &MapRecv::processSetTilesType, 0); packet(SMSG_NPC_SKIN, 0x0b1c, -1, &NpcRecv::processNpcSkin, 0); + packet(SMSG_PLAYER_KILLED_BY, 0x0b1d, 6, &PlayerRecv::processKilledBy, 0); // char server packet(SMSG_CHAR_PASSWORD_RESPONSE, 0x0062, 3, &LoginRecv::processCharPasswordResponse, 0); diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index f7a6e637d..b58872712 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -22,6 +22,7 @@ #include "net/eathena/playerrecv.h" +#include "actormanager.h" #include "configuration.h" #include "notifymanager.h" #include "party.h" @@ -37,9 +38,12 @@ #include "gui/windows/statuswindow.h" #include "gui/windows/whoisonline.h" -#include "net/messagein.h" +#include "gui/widgets/tabs/chat/chattab.h" #include "net/eathena/sp.h" +#include "net/messagein.h" + +#include "utils/gettext.h" #include "debug.h" @@ -428,4 +432,28 @@ void PlayerRecv::processDressRoomOpen(Net::MessageIn &msg) msg.readInt16("view"); } +void PlayerRecv::processKilledBy(Net::MessageIn &msg) +{ + const BeingId id = msg.readBeingId("killer id"); + Being *const dstBeing = actorManager->findBeing(id); + if (id == BeingId_zero) + { + debugMsg(strprintf( + // TRANSLATORS: player killed message + _("You were killed by unknown source."))); + } + else + { + std::string name; + if (dstBeing) + name = dstBeing->getName(); + else + name = strprintf("?%u", CAST_U32(id)); + debugMsg(strprintf( + // TRANSLATORS: player killed message + _("You were killed by %s."), + name.c_str())); + } +} + } // namespace EAthena diff --git a/src/net/eathena/playerrecv.h b/src/net/eathena/playerrecv.h index 22cb57822..b768edd0d 100644 --- a/src/net/eathena/playerrecv.h +++ b/src/net/eathena/playerrecv.h @@ -51,6 +51,7 @@ namespace EAthena void processPlayerRankPoints(Net::MessageIn &msg); void processOnlineList(Net::MessageIn &msg); void processDressRoomOpen(Net::MessageIn &msg); + void processKilledBy(Net::MessageIn &msg); } // namespace PlayerRecv } // namespace EAthena diff --git a/src/net/eathena/serverfeatures.cpp b/src/net/eathena/serverfeatures.cpp index f995f55ad..e8abbfdcf 100644 --- a/src/net/eathena/serverfeatures.cpp +++ b/src/net/eathena/serverfeatures.cpp @@ -295,4 +295,9 @@ bool ServerFeatures::haveMoveWhileSit() const return serverVersion > 0; } +bool ServerFeatures::haveKillerId() const +{ + return serverVersion >= 14; +} + } // namespace EAthena diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp index b533301a7..a83a6362a 100644 --- a/src/net/tmwa/serverfeatures.cpp +++ b/src/net/tmwa/serverfeatures.cpp @@ -293,4 +293,9 @@ bool ServerFeatures::haveMoveWhileSit() const return true; } +bool ServerFeatures::haveKillerId() const +{ + return false; +} + } // namespace TmwAthena |