From 42c36429d7cd1e6c3f879b6749e18e912deefe0d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 19 May 2014 20:40:56 +0100 Subject: Added client translation to achievements --- src/CompositeChat.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/CompositeChat.h') diff --git a/src/CompositeChat.h b/src/CompositeChat.h index 5b9c5f612..a0264d864 100644 --- a/src/CompositeChat.h +++ b/src/CompositeChat.h @@ -38,6 +38,7 @@ public: ptUrl, ptRunCommand, ptSuggestCommand, + ptShowAchievement, } ; class cBasePart @@ -106,6 +107,15 @@ public: public: cSuggestCommandPart(const AString & a_Text, const AString & a_Command, const AString & a_Style = ""); } ; + + class cShowAchievementPart : + public cBasePart + { + typedef cBasePart super; + public: + AString m_PlayerName; + cShowAchievementPart(const AString & a_PlayerName, const AString & a_Achievement, const AString & a_Style = ""); + } ; typedef std::vector cParts; @@ -148,6 +158,11 @@ public: /** Adds a part that suggests a command (enters it into the chat message area, but doesn't send) when clicked. The default style is underlined yellow text. */ void AddSuggestCommandPart(const AString & a_Text, const AString & a_SuggestedCommand, const AString & a_Style = "u@b"); + + /** Adds a part that fully formats a specified achievement using client translatable strings + Takes achievement name and player awarded to. Displays as {player} has earned the achievement {achievement_name}. + */ + void AddShowAchievementPart(const AString & a_PlayerName, const AString & a_Achievement, const AString & a_Style = ""); /** Parses text into various parts, adds those. Recognizes "http:" and "https:" URLs and @color-codes. */ -- cgit v1.2.3 From 3a9543178abb7500aff65e09f054c28200ca6cac Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 19 May 2014 21:16:29 +0100 Subject: cCompositeChat message type is now formatted --- src/CompositeChat.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/CompositeChat.h') diff --git a/src/CompositeChat.h b/src/CompositeChat.h index a0264d864..209d9d925 100644 --- a/src/CompositeChat.h +++ b/src/CompositeChat.h @@ -47,6 +47,7 @@ public: ePartType m_PartType; AString m_Text; AString m_Style; + AString m_AdditionalStyleData; cBasePart(ePartType a_PartType, const AString & a_Text, const AString & a_Style = ""); @@ -169,7 +170,7 @@ public: void ParseText(const AString & a_ParseText); /** Sets the message type, which is indicated by prefixes added to the message when serializing. */ - void SetMessageType(eMessageType a_MessageType); + void SetMessageType(eMessageType a_MessageType, const AString & a_AdditionalMessageTypeata = ""); /** Adds the "underline" style to each part that is an URL. */ void UnderlineUrls(void); @@ -178,6 +179,9 @@ public: /** Returns the message type set previously by SetMessageType(). */ eMessageType GetMessageType(void) const { return m_MessageType; } + + /** Returns additional data pertaining to message type, for example, the name of a mtPrivateMsg sender */ + AString GetAdditionalMessageTypeData(void) const { return m_AdditionalMessageTypeData; } /** Returns the text from the parts that comprises the human-readable data. Used for older protocols that don't support composite chat @@ -199,6 +203,9 @@ protected: /** The message type, as indicated by prefixes. */ eMessageType m_MessageType; + /** Additional data pertaining to message type, for example, the name of a mtPrivateMsg sender */ + AString m_AdditionalMessageTypeData; + /** Adds a_AddStyle to a_Style; overwrites the existing style if appropriate. If the style already contains something that a_AddStyle overrides, it is erased first. */ -- cgit v1.2.3 From 576e17ae08ddd0dcff625134325bfceeab956906 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 20 May 2014 22:49:21 +0100 Subject: Update CompositeChat.h --- src/CompositeChat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/CompositeChat.h') diff --git a/src/CompositeChat.h b/src/CompositeChat.h index 209d9d925..1ad196f1d 100644 --- a/src/CompositeChat.h +++ b/src/CompositeChat.h @@ -169,8 +169,10 @@ public: Recognizes "http:" and "https:" URLs and @color-codes. */ void ParseText(const AString & a_ParseText); - /** Sets the message type, which is indicated by prefixes added to the message when serializing. */ - void SetMessageType(eMessageType a_MessageType, const AString & a_AdditionalMessageTypeata = ""); + /** Sets the message type, which is indicated by prefixes added to the message when serializing + Takes optional AdditionalMessageTypeData to set m_AdditionalMessageTypeData. See said variable for more documentation. + */ + void SetMessageType(eMessageType a_MessageType, const AString & a_AdditionalMessageTypeData = ""); /** Adds the "underline" style to each part that is an URL. */ void UnderlineUrls(void); -- cgit v1.2.3