diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-04-04 21:25:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-04-04 21:25:57 +0300 |
commit | 73a19644de201aa63ed9d1cf9feaa80873a85b4d (patch) | |
tree | ed11be06d0a58a433ed91a2db1526fb455d03811 | |
parent | 22bdb49dc36281ed99b1f2b5199ef36c9417dcf5 (diff) | |
download | mv-73a19644de201aa63ed9d1cf9feaa80873a85b4d.tar.gz mv-73a19644de201aa63ed9d1cf9feaa80873a85b4d.tar.bz2 mv-73a19644de201aa63ed9d1cf9feaa80873a85b4d.tar.xz mv-73a19644de201aa63ed9d1cf9feaa80873a85b4d.zip |
Show player language badge.
-rw-r--r-- | src/being/being.cpp | 19 | ||||
-rw-r--r-- | src/being/being.h | 3 | ||||
-rw-r--r-- | src/enums/being/badgeindex.h | 1 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 4 |
4 files changed, 26 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 45aa67bac..eef9b1d40 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -89,6 +89,7 @@ #include "resources/db/emotedb.h" #include "resources/db/homunculusdb.h" #include "resources/db/horsedb.h" +#include "resources/db/languagedb.h" #include "resources/db/mercenarydb.h" #include "resources/db/monsterdb.h" #include "resources/db/npcdb.h" @@ -248,6 +249,7 @@ Being::Being(const BeingId id, mManner(0), mAreaSize(11), mCastEndTime(0), + mLanguageId(-1), mCreatorId(BeingId_zero), mTeamId(0U), mLook(0U), @@ -5326,3 +5328,20 @@ void Being::fixDirectionOffsets(int &offsetX, offsetX = tmp; } } + +void Being::setLanguageId(const int lang) restrict2 noexcept2 +{ + if (lang != mLanguageId) + { + delete2(mBadges[BadgeIndex::Lang]); + const std::string badge = LanguageDb::getIcon(lang); + if (!badge.empty()) + { + mBadges[BadgeIndex::Lang] = AnimatedSprite::load(pathJoin( + paths.getStringValue("languageIcons"), + badge)); + } + + mLanguageId = lang; + } +} diff --git a/src/being/being.h b/src/being/being.h index ae4fe3dd8..0110f3141 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1061,6 +1061,8 @@ class Being notfinal : public ActorSprite, void showBadges(const bool show) restrict2; + void setLanguageId(const int lang) restrict2 noexcept2; + uint16_t getTeamId() const restrict2 noexcept2 A_WARN_UNUSED { return mTeamId; } @@ -1323,6 +1325,7 @@ class Being notfinal : public ActorSprite, int mManner; int mAreaSize; int mCastEndTime; + int mLanguageId; BeingId mCreatorId; uint16_t mTeamId; uint16_t mLook; diff --git a/src/enums/being/badgeindex.h b/src/enums/being/badgeindex.h index f91295c57..727f52b49 100644 --- a/src/enums/being/badgeindex.h +++ b/src/enums/being/badgeindex.h @@ -33,6 +33,7 @@ enum2Start(BadgeIndex) Guild = 5, Party = 6, Name = 7, + Lang = 8, BadgeIndexSize } diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 84bf9ee0c..6c78a8f40 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1744,8 +1744,9 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) uint16_t mount = 0; if (haveMount) mount = msg.readInt16("mount"); + int language = -1; if (serverVersion >= 17) - msg.readInt16("language"); + language = msg.readInt16("language"); if (dstBeing) { if (gmLevel) @@ -1764,6 +1765,7 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) { dstBeing->setHorse(mount); } + dstBeing->setLanguageId(language); } } |