diff options
author | Mattes D <github@xoft.cz> | 2014-05-25 10:42:30 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-05-25 10:42:30 +0200 |
commit | 0849e66d039ef390b8525e9e411882ce1b4ad91e (patch) | |
tree | b14c5ade801aa9ba681ba598d3ceed63e444ec81 /src/Protocol/Protocol17x.cpp | |
parent | Updated Core (diff) | |
parent | Merge branch 'master' into achievementtranslate (diff) | |
download | cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.tar cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.tar.gz cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.tar.bz2 cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.tar.lz cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.tar.xz cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.tar.zst cuberite-0849e66d039ef390b8525e9e411882ce1b4ad91e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 39feee16f..7c526d103 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -234,7 +234,7 @@ void cProtocol172::SendChat(const cCompositeChat & a_Message) // Compose the complete Json string to send: Json::Value msg; - msg["text"] = ""; // The client crashes without this + msg["text"] = cClientHandle::FormatMessageType(m_Client->GetPlayer()->GetWorld()->ShouldUseChatPrefixes(), a_Message.GetMessageType(), a_Message.GetAdditionalMessageTypeData()); // The client crashes without this field being present const cCompositeChat::cParts & Parts = a_Message.GetParts(); for (cCompositeChat::cParts::const_iterator itr = Parts.begin(), end = Parts.end(); itr != end; ++itr) { @@ -289,6 +289,35 @@ void cProtocol172::SendChat(const cCompositeChat & a_Message) AddChatPartStyle(Part, p.m_Style); break; } + + case cCompositeChat::ptShowAchievement: + { + const cCompositeChat::cShowAchievementPart & p = (const cCompositeChat::cShowAchievementPart &)**itr; + Part["translate"] = "chat.type.achievement"; + + Json::Value Ach; + Ach["action"] = "show_achievement"; + Ach["value"] = p.m_Text; + + Json::Value AchColourAndName; + AchColourAndName["color"] = "green"; + AchColourAndName["translate"] = p.m_Text; + AchColourAndName["hoverEvent"] = Ach; + + Json::Value Extra; + Extra.append(AchColourAndName); + + Json::Value Name; + Name["text"] = p.m_PlayerName; + + Json::Value With; + With.append(Name); + With.append(Extra); + + Part["with"] = With; + AddChatPartStyle(Part, p.m_Style); + break; + } } msg["extra"].append(Part); } // for itr - Parts[] |