diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-10 20:30:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-10 20:30:10 +0300 |
commit | 890fd4c9ceab089de688b00acf5163d795ccec4a (patch) | |
tree | bcaf7fb78fdb6a0fb426f2abe9a9636cb2050076 /src | |
parent | 7c6f3d5a9cc4e83520dc8c2ac75ec987e730d381 (diff) | |
download | manaplus-890fd4c9ceab089de688b00acf5163d795ccec4a.tar.gz manaplus-890fd4c9ceab089de688b00acf5163d795ccec4a.tar.bz2 manaplus-890fd4c9ceab089de688b00acf5163d795ccec4a.tar.xz manaplus-890fd4c9ceab089de688b00acf5163d795ccec4a.zip |
eathena: add packet SMSG_BEING_ATTRS 0x0b0a.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.h | 2 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 27 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packets.h | 2 | ||||
-rw-r--r-- | src/net/eathena/protocol.h | 1 |
7 files changed, 41 insertions, 1 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index d5a195753..efe6bf3bb 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -57,6 +57,7 @@ #include "gui/windows/outfitwindow.h" #include "gui/windows/shopwindow.h" #include "gui/windows/socialwindow.h" +#include "gui/windows/statuswindow.h" #include "gui/windows/updaterwindow.h" #include "gui/widgets/tabs/chat/gmtab.h" @@ -401,6 +402,8 @@ void LocalPlayer::setGMLevel(const int level) if (level > 0) { setGM(true); + if (statusWindow) + statusWindow->updateLevelLabel(); if (chatWindow) { chatWindow->loadGMCommands(); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index db03fbe70..d16262cc1 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -240,6 +240,11 @@ StatusWindow::StatusWindow() : PlayerInfo::getAttribute(Attributes::CHAR_POINTS))); mCharacterPointsLabel->adjustSize(); + updateLevelLabel(); +} + +void StatusWindow::updateLevelLabel() +{ if (localPlayer && localPlayer->isGM()) { // TRANSLATORS: status window label diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h index 3bc5ab6f3..34462498b 100644 --- a/src/gui/windows/statuswindow.h +++ b/src/gui/windows/statuswindow.h @@ -93,6 +93,8 @@ class StatusWindow final : public Window, const int oldVal1, const int oldVal2) override final; + void updateLevelLabel(); + private: static std::string translateLetter(const char *const letters); static std::string translateLetter2(const std::string &letters); diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index ab8700227..a3458c9f8 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -112,6 +112,7 @@ BeingHandler::BeingHandler(const bool enableSync) : SMSG_BEING_STAT_UPDATE_1, SMSG_MOB_INFO, SMSG_BEING_MOVE3, + SMSG_BEING_ATTRS, 0 }; handledMessages = _messages; @@ -301,6 +302,10 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) processBeingMove3(msg); break; + case SMSG_BEING_ATTRS: + processBeingAttrs(msg); + break; + default: break; } @@ -1546,4 +1551,26 @@ void BeingHandler::processMobInfo(Net::MessageIn &msg) dstBeing->setAttackRange(attackRange); } +void BeingHandler::processBeingAttrs(Net::MessageIn &msg) +{ + const int len = msg.readInt16("len"); + if (len < 12) + return; + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("player id")); + const int gmLevel = msg.readInt32("gm level"); + if (dstBeing && gmLevel) + { + if (dstBeing == localPlayer) + localPlayer->setGMLevel(gmLevel); + dstBeing->setGM(true); + } + else + { + if (dstBeing == localPlayer) + localPlayer->setGMLevel(0); + dstBeing->setGM(false); + } +} + } // namespace EAthena diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index 54b2e8059..9c0d0b920 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -118,6 +118,8 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler static void processBeingSelfEffect(Net::MessageIn &msg); static void processMobInfo(Net::MessageIn &msg); + + static void processBeingAttrs(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 63fa106d3..600a1a41e 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -281,7 +281,7 @@ int16_t packet_lengths[] = //0 1 2 3 4 5 6 7 8 9 a b c d e f //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // #0x0B00 - 16, -1, 10, -1, -1, -1, -1, 0, 27, 0, 0, 0, 0, 0, 0, 0, + 16, -1, 10, -1, -1, -1, -1, 0, 27, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index baf048c56..3c713ff72 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -127,6 +127,7 @@ #define SMSG_BEING_CHANGE_DIRECTION 0x009c #define SMSG_BEING_RESURRECT 0x0148 #define SMSG_BEING_STAT_UPDATE_1 0x01ab +#define SMSG_BEING_ATTRS 0x0b0a #define SMSG_PLAYER_STATUS_CHANGE 0x0229 #define SMSG_PLAYER_STATUS_CHANGE2 0x028a |