Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Area Server Events #64

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Fragment.NetSlum.Networking/Constants/OpCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,14 @@ public enum OpCodes : ushort
Data_AreaServerPublishDetails2Request = 0x7016,
Data_AreaServerPublishDetails3Request = 0x7881,
Data_AreaServerPublishDetails4Request = 0x7887,
Data_AreaServerPublishDetails6Request = 0x78a7,
Data_AreaServerDateTimeRequest = 0x78a7,

Data_AreaServerPublishDetails1Success = 0x7012,
Data_AreaServerPublishDetails2Success = 0x7017,
Data_AreaServerPublishDetails3Success = 0x7882,
Data_AreaServerPublishDetails4Success = 0x7888,
Data_AreaServerPublishDetails5Success = 0x741e,
Data_AreaServerPublishDetails6Success = 0x78a8,
Data_AreaServerDateTimeSuccess = 0x78a8,
Data_AreaServerPublishDetails7Success = 0x780d,


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Fragment.NetSlum.Core.Extensions;
using Fragment.NetSlum.Networking.Attributes;
using Fragment.NetSlum.Networking.Constants;
using Fragment.NetSlum.Networking.Objects;
using Fragment.NetSlum.Networking.Packets.Response;
using Fragment.NetSlum.Networking.Sessions;
using Microsoft.Extensions.Logging;
using Fragment.NetSlum.Networking.Packets.Response.AreaServer;
using Fragment.NetSlum.TcpServer.Extensions;

namespace Fragment.NetSlum.Networking.Packets.Request.AreaServer;

[FragmentPacket(MessageType.Data, OpCodes.Data_AreaServerDateTimeRequest)]
public class AreaServerDateTimeRequest : BaseRequest
{
private readonly ILogger<AreaServerIPAddressPortRequest> _logger;

public AreaServerDateTimeRequest(ILogger<AreaServerIPAddressPortRequest> logger)
{
_logger = logger;
}

public override ValueTask<ICollection<FragmentMessage>> GetResponse(FragmentTcpSession session, FragmentMessage request)
{
BaseResponse response = new AreaServerDateTimeResponse();
return SingleMessage(response.Build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace Fragment.NetSlum.Networking.Packets.Request.AreaServer;
[FragmentPacket(MessageType.Data, OpCodes.Data_AreaServerPublishDetails2Request)]
[FragmentPacket(MessageType.Data, OpCodes.Data_AreaServerPublishDetails3Request)]
[FragmentPacket(MessageType.Data, OpCodes.Data_AreaServerPublishDetails4Request)]
[FragmentPacket(MessageType.Data, OpCodes.Data_AreaServerPublishDetails6Request)]
public class AreaServerPublishDetailsRequest:BaseRequest
{
private readonly FragmentContext _database;
Expand Down Expand Up @@ -70,8 +69,6 @@ public override ValueTask<ICollection<FragmentMessage>> GetResponse(FragmentTcpS
]
};
break;
case OpCodes.Data_AreaServerPublishDetails6Request:
//response = new AreaServerPublishDetailsResponse() { PacketType = OpCodes.Data_AreaServerPublishDetails6Success, Data = new byte[] { 0x00, 0x09 } };
default:
return NoResponse();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Fragment.NetSlum.Core.Buffers;
using Fragment.NetSlum.Core.Extensions;
using Fragment.NetSlum.Networking.Constants;
using Fragment.NetSlum.Networking.Objects;
using System;
using System.Buffers.Binary;

namespace Fragment.NetSlum.Networking.Packets.Response.AreaServer;

public class AreaServerDateTimeResponse : BaseResponse
{
public override FragmentMessage Build()
{
var writer = new MemoryWriter(8);
writer.Write((uint)0);
writer.Write((uint)DateTime.UtcNow.ToEpoch());

return new FragmentMessage
{
MessageType = MessageType.Data,
DataPacketType = OpCodes.Data_AreaServerDateTimeSuccess,
Data = writer.Buffer,
};
}
}
Loading