1
0

Merge branch 'master' into master

This commit is contained in:
electromatter
2015-09-21 22:44:34 -04:00
38 changed files with 405 additions and 1017 deletions

View File

@@ -246,84 +246,28 @@ void cProtocol180::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockV
void cProtocol180::SendChat(const AString & a_Message)
{
this->SendChatType(a_Message, ctChatBox);
}
void cProtocol180::SendChat(const cCompositeChat & a_Message)
{
this->SendChatType(a_Message, ctChatBox);
}
void cProtocol180::SendChatSystem(const AString & a_Message)
{
this->SendChatType(a_Message, ctSystem);
}
void cProtocol180::SendChatSystem(const cCompositeChat & a_Message)
{
this->SendChatType(a_Message, ctSystem);
}
void cProtocol180::SendChatAboveActionBar(const AString & a_Message)
{
this->SendChatType(a_Message, ctAboveActionBar);
}
void cProtocol180::SendChatAboveActionBar(const cCompositeChat & a_Message)
{
this->SendChatType(a_Message, ctAboveActionBar);
}
void cProtocol180::SendChatType(const AString & a_Message, eChatType type)
void cProtocol180::SendChat(const AString & a_Message, eChatType a_Type)
{
ASSERT(m_State == 3); // In game mode?
cPacketizer Pkt(*this, 0x02); // Chat Message packet
Pkt.WriteString(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()));
Pkt.WriteBEInt8(type);
Pkt.WriteBEInt8(a_Type);
}
void cProtocol180::SendChatType(const cCompositeChat & a_Message, eChatType type)
void cProtocol180::SendChat(const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes)
{
ASSERT(m_State == 3); // In game mode?
cWorld * World = m_Client->GetPlayer()->GetWorld();
bool ShouldUseChatPrefixes = (World == nullptr) ? false : World->ShouldUseChatPrefixes();
// Send the message to the client:
cPacketizer Pkt(*this, 0x02);
Pkt.WriteString(a_Message.CreateJsonString(ShouldUseChatPrefixes));
Pkt.WriteBEInt8(type);
Pkt.WriteString(a_Message.CreateJsonString(a_ShouldUseChatPrefixes));
Pkt.WriteBEInt8(a_Type);
}