parent
4a24e39ac1
commit
ea55a22a71
@ -1089,14 +1089,20 @@ void cClientHandle::HandleChat(const AString & a_Message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not a command, broadcast as a simple message:
|
// Not a command, broadcast as a message:
|
||||||
AString Msg;
|
cCompositeChat Msg;
|
||||||
Printf(Msg, "%s<%s>%s %s",
|
AString Color = m_Player->GetColor();
|
||||||
m_Player->GetColor().c_str(),
|
if (Color.length() == 3)
|
||||||
m_Player->GetName().c_str(),
|
{
|
||||||
cChatColor::White.c_str(),
|
Color = AString("@") + Color[2];
|
||||||
Message.c_str()
|
}
|
||||||
);
|
else
|
||||||
|
{
|
||||||
|
Color.empty();
|
||||||
|
}
|
||||||
|
Msg.AddTextPart(AString("<") + m_Player->GetName() + "> ", Color);
|
||||||
|
Msg.ParseText(a_Message);
|
||||||
|
Msg.UnderlineUrls();
|
||||||
m_Player->GetWorld()->BroadcastChat(Msg);
|
m_Player->GetWorld()->BroadcastChat(Msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +299,21 @@ void cCompositeChat::SetMessageType(eMessageType a_MessageType)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cCompositeChat::UnderlineUrls(void)
|
||||||
|
{
|
||||||
|
for (cParts::iterator itr = m_Parts.begin(), end = m_Parts.end(); itr != end; ++itr)
|
||||||
|
{
|
||||||
|
if ((*itr)->m_PartType == ptUrl)
|
||||||
|
{
|
||||||
|
(*itr)->m_Style.append("u");
|
||||||
|
}
|
||||||
|
} // for itr - m_Parts[]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cCompositeChat::AddStyle(AString & a_Style, const AString & a_AddStyle)
|
void cCompositeChat::AddStyle(AString & a_Style, const AString & a_AddStyle)
|
||||||
{
|
{
|
||||||
if (a_AddStyle.empty())
|
if (a_AddStyle.empty())
|
||||||
|
@ -155,6 +155,9 @@ public:
|
|||||||
/** Returns the message type set previously by SetMessageType(). */
|
/** Returns the message type set previously by SetMessageType(). */
|
||||||
eMessageType GetMessageType(void) const { return m_MessageType; }
|
eMessageType GetMessageType(void) const { return m_MessageType; }
|
||||||
|
|
||||||
|
/** Adds the "underline" style to each part that is an URL. */
|
||||||
|
void UnderlineUrls(void);
|
||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
const cParts & GetParts(void) const { return m_Parts; }
|
const cParts & GetParts(void) const { return m_Parts; }
|
||||||
|
@ -226,7 +226,8 @@ public:
|
|||||||
|
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
/// Returns the full color code to use for this player, based on their primary group or set in m_Color
|
/** Returns the full color code to use for this player, based on their primary group or set in m_Color.
|
||||||
|
The returned value includes the cChatColor::Delimiter. */
|
||||||
AString GetColor(void) const;
|
AString GetColor(void) const;
|
||||||
|
|
||||||
/** tosses the item in the selected hotbar slot */
|
/** tosses the item in the selected hotbar slot */
|
||||||
|
Loading…
Reference in New Issue
Block a user