Added SendMessageRaw for sending json string.
This commit is contained in:
parent
502b5ec732
commit
b088123d18
@ -11698,6 +11698,22 @@ a_Player:OpenWindow(Window);
|
||||
},
|
||||
Notes = "Sends the specified message to the player.",
|
||||
},
|
||||
SendMessageRaw =
|
||||
{
|
||||
Params =
|
||||
{
|
||||
{
|
||||
Name = "Json",
|
||||
Type = "string",
|
||||
},
|
||||
{
|
||||
Name = "eChatType",
|
||||
Type = "number",
|
||||
IsOptional = true,
|
||||
}
|
||||
},
|
||||
Notes = "Sends the specified json string to the player. The optional value eChatType (default ctChatBox) can be ctChatBox, ctSystem or ctAboveActionBar. You can use {{cJson}} to build a json string.",
|
||||
},
|
||||
SendMessageFailure =
|
||||
{
|
||||
Params =
|
||||
|
@ -2271,6 +2271,15 @@ void cClientHandle::SendChat(const cCompositeChat & a_Message)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type)
|
||||
{
|
||||
m_Protocol->SendChatRaw(a_MessageRaw, a_Type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendChatAboveActionBar(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData)
|
||||
{
|
||||
cWorld * World = GetPlayer()->GetWorld();
|
||||
|
@ -153,6 +153,7 @@ public: // tolua_export
|
||||
void SendCameraSetTo (const cEntity & a_Entity);
|
||||
void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
|
||||
void SendChat (const cCompositeChat & a_Message);
|
||||
void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type);
|
||||
void SendChatAboveActionBar (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
|
||||
void SendChatAboveActionBar (const cCompositeChat & a_Message);
|
||||
void SendChatSystem (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
|
||||
|
@ -256,6 +256,7 @@ public:
|
||||
void SendMessageFatal (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
|
||||
void SendMessagePrivateMsg (const AString & a_Message, const AString & a_Sender) { m_ClientHandle->SendChat(a_Message, mtPrivateMessage, a_Sender); }
|
||||
void SendMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChat(a_Message); }
|
||||
void SendMessageRaw (const AString & a_MessageRaw, eChatType a_Type = eChatType::ctChatBox) { m_ClientHandle->SendChatRaw(a_MessageRaw, a_Type); }
|
||||
|
||||
void SendSystemMessage (const AString & a_Message) { m_ClientHandle->SendChatSystem(a_Message, mtCustom); }
|
||||
void SendAboveActionBarMessage(const AString & a_Message) { m_ClientHandle->SendChatAboveActionBar(a_Message, mtCustom); }
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
virtual void SendCameraSetTo (const cEntity & a_Entity) = 0;
|
||||
virtual void SendChat (const AString & a_Message, eChatType a_Type) = 0;
|
||||
virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) = 0;
|
||||
virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) = 0;
|
||||
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) = 0;
|
||||
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) = 0;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
|
||||
|
@ -284,6 +284,20 @@ void cProtocol180::SendChat(const cCompositeChat & a_Message, eChatType a_Type,
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
// Send the json string to the client:
|
||||
cPacketizer Pkt(*this, 0x02);
|
||||
Pkt.WriteString(a_MessageRaw);
|
||||
Pkt.WriteBEInt8(a_Type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol180::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
virtual void SendCameraSetTo (const cEntity & a_Entity) override;
|
||||
virtual void SendChat (const AString & a_Message, eChatType a_Type) override;
|
||||
virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) override;
|
||||
virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) override;
|
||||
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
|
||||
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
|
@ -293,6 +293,20 @@ void cProtocol190::SendChat(const cCompositeChat & a_Message, eChatType a_Type,
|
||||
|
||||
|
||||
|
||||
void cProtocol190::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
||||
// Send the json string to the client:
|
||||
cPacketizer Pkt(*this, 0x0f); // Chat Message packet
|
||||
Pkt.WriteString(a_MessageRaw);
|
||||
Pkt.WriteBEInt8(a_Type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocol190::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
|
||||
{
|
||||
ASSERT(m_State == 3); // In game mode?
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
virtual void SendCameraSetTo (const cEntity & a_Entity) override;
|
||||
virtual void SendChat (const AString & a_Message, eChatType a_Type) override;
|
||||
virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) override;
|
||||
virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) override;
|
||||
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
|
||||
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
|
@ -200,6 +200,16 @@ void cProtocolRecognizer::SendChat(const cCompositeChat & a_Message, eChatType a
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendChatRaw(const AString & a_MessageRaw, eChatType a_Type)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
m_Protocol->SendChatRaw(a_MessageRaw, a_Type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cProtocolRecognizer::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
|
||||
{
|
||||
ASSERT(m_Protocol != nullptr);
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
virtual void SendCameraSetTo (const cEntity & a_Entity) override;
|
||||
virtual void SendChat (const AString & a_Message, eChatType a_Type) override;
|
||||
virtual void SendChat (const cCompositeChat & a_Message, eChatType a_Type, bool a_ShouldUseChatPrefixes) override;
|
||||
virtual void SendChatRaw (const AString & a_MessageRaw, eChatType a_Type) override;
|
||||
virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override;
|
||||
virtual void SendCollectEntity (const cEntity & a_Entity, const cPlayer & a_Player) override;
|
||||
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
|
||||
|
Loading…
Reference in New Issue
Block a user