mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-03-04 09:25:22 +03:00
Add ChatMessageQuery/Reply.
This commit is contained in:
parent
5c84357edb
commit
95b68d63c6
@ -17,6 +17,17 @@ namespace Syroot.Worms.Mgame.GameServer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleWwpaChannelChatMessage(ChatMessageQuery packet)
|
||||||
|
{
|
||||||
|
SendPacket(new ChatMessageReply
|
||||||
|
{
|
||||||
|
UnknownA = 0,
|
||||||
|
Scene = ChatMessageScene.Current,
|
||||||
|
UnknownB = "Bla",
|
||||||
|
Message = packet.Message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleWwpaChannelCmdFindUser(CmdFindUserQuery packet)
|
public void HandleWwpaChannelCmdFindUser(CmdFindUserQuery packet)
|
||||||
{
|
{
|
||||||
SendPacket(new CmdFindUserReply
|
SendPacket(new CmdFindUserReply
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using Syroot.BinaryData.Memory;
|
||||||
|
|
||||||
|
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the client request for a <see cref="ChatMessageReply"/>.
|
||||||
|
/// </summary>
|
||||||
|
[WwpaPacket(0x114)]
|
||||||
|
internal class ChatMessageQuery : IPacket
|
||||||
|
{
|
||||||
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public int UnknownA { get; set; }
|
||||||
|
|
||||||
|
public int UnknownB { get; set; } // Always 3?
|
||||||
|
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public void Load(ref SpanReader reader)
|
||||||
|
{
|
||||||
|
UnknownA = reader.ReadInt32();
|
||||||
|
UnknownB = reader.ReadInt32();
|
||||||
|
Message = reader.ReadString2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(ref SpanWriter writer) => throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using Syroot.BinaryData.Memory;
|
||||||
|
|
||||||
|
namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua.Channel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the server response to a <see cref="ChatMessageQuery"/>.
|
||||||
|
/// </summary>
|
||||||
|
[WwpaPacket(0x115)]
|
||||||
|
internal class ChatMessageReply : IPacket
|
||||||
|
{
|
||||||
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public ChatMessageScene Scene { get; set; }
|
||||||
|
|
||||||
|
public int UnknownA { get; set; }
|
||||||
|
|
||||||
|
public string UnknownB { get; set; }
|
||||||
|
|
||||||
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public void Load(ref SpanReader reader) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public void Save(ref SpanWriter writer)
|
||||||
|
{
|
||||||
|
writer.WriteEnumSafe(Scene);
|
||||||
|
writer.WriteInt32(UnknownA);
|
||||||
|
writer.WriteString2(UnknownB);
|
||||||
|
writer.WriteString2(Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum ChatMessageScene : int
|
||||||
|
{
|
||||||
|
WaitRoom = 1,
|
||||||
|
GameRoom = 3,
|
||||||
|
Current = 99
|
||||||
|
}
|
||||||
|
}
|
@ -119,6 +119,8 @@ namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
|||||||
return (IPacket)Activator.CreateInstance(packets[0].type);
|
return (IPacket)Activator.CreateInstance(packets[0].type);
|
||||||
|
|
||||||
// No unique packet found, check for matching command.
|
// No unique packet found, check for matching command.
|
||||||
|
if (!reader.IsEndOfSpan)
|
||||||
|
{
|
||||||
int command = reader.ReadInt32();
|
int command = reader.ReadInt32();
|
||||||
packets = packets.Where(x => x.attrib.Command == command).ToList();
|
packets = packets.Where(x => x.attrib.Command == command).ToList();
|
||||||
if (packets.Count == 1)
|
if (packets.Count == 1)
|
||||||
@ -126,6 +128,7 @@ namespace Syroot.Worms.Mgame.GameServer.Packets.WorldPartyAqua
|
|||||||
|
|
||||||
// No unique packet found, return fallback.
|
// No unique packet found, return fallback.
|
||||||
reader.Position -= sizeof(int);
|
reader.Position -= sizeof(int);
|
||||||
|
}
|
||||||
return new RawPacket { ID = id };
|
return new RawPacket { ID = id };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user