-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef74c5f
commit efa35d0
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Lagrange.Core/Internal/Event/Action/FetchGroupAtAllRemainEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace Lagrange.Core.Internal.Event.Action; | ||
|
||
internal class FetchGroupAtAllRemainEvent : ProtocolEvent | ||
{ | ||
public uint GroupUin { get; set; } | ||
|
||
public uint RemainAtAllCountForUin { get; set; } | ||
|
||
public uint RemainAtAllCountForGroup { get; set; } | ||
|
||
private FetchGroupAtAllRemainEvent(uint groupUin) : base(true) | ||
{ | ||
GroupUin = groupUin; | ||
} | ||
|
||
private FetchGroupAtAllRemainEvent(int resultCode, uint remainAtAllCountForUin, uint remainAtAllCountForGroup) : base(resultCode) | ||
{ | ||
RemainAtAllCountForUin = remainAtAllCountForUin; | ||
RemainAtAllCountForGroup = remainAtAllCountForGroup; | ||
} | ||
|
||
public static FetchGroupAtAllRemainEvent Create(uint groupUin) => new(groupUin); | ||
|
||
public static FetchGroupAtAllRemainEvent Result(int resultCode, uint remainAtAllCountForUin, uint remainAtAllCountForGroup) => | ||
new(resultCode, remainAtAllCountForUin, remainAtAllCountForGroup); | ||
} |
18 changes: 18 additions & 0 deletions
18
Lagrange.Core/Internal/Packets/Service/Oidb/Request/OidbSvcTrpcTcp0x8A7_0.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.Service.Oidb.Request; | ||
|
||
[ProtoContract] | ||
[OidbSvcTrpcTcp(0x8A7, 0)] | ||
internal class OidbSvcTrpcTcp0x8A7_0 | ||
{ | ||
[ProtoMember(1)] public uint SubCmd { get; set; } | ||
|
||
[ProtoMember(2)] public uint LimitIntervalTypeForUin { get; set; } | ||
|
||
[ProtoMember(3)] public uint LimitIntervalTypeForGroup { get; set; } | ||
|
||
[ProtoMember(4)] public uint Uin { get; set; } | ||
|
||
[ProtoMember(5)] public uint GroupCode { get; set; } | ||
} |
17 changes: 17 additions & 0 deletions
17
Lagrange.Core/Internal/Packets/Service/Oidb/Response/OidbSvcTrpcTcp0x8A7_0Response.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Packets.Service.Oidb.Response; | ||
|
||
[ProtoContract] | ||
internal class OidbSvcTrpcTcp0x8A7_0Response | ||
{ | ||
[ProtoMember(1)] public bool CanAtAll { get; set; } | ||
|
||
[ProtoMember(2)] public uint RemainAtAllCountForUin { get; set; } | ||
|
||
[ProtoMember(3)] public uint RemainAtAllCountForGroup { get; set; } | ||
|
||
[ProtoMember(4)] public string? PromptMsg1 { get; set; } | ||
|
||
[ProtoMember(5)] public string? PromptMsg2 { get; set; } | ||
} |
41 changes: 41 additions & 0 deletions
41
Lagrange.Core/Internal/Service/Action/FetchGroupAtAllRemainService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Lagrange.Core.Common; | ||
using Lagrange.Core.Internal.Event; | ||
using Lagrange.Core.Internal.Event.Action; | ||
using Lagrange.Core.Internal.Packets.Service.Oidb; | ||
using Lagrange.Core.Internal.Packets.Service.Oidb.Request; | ||
using Lagrange.Core.Internal.Packets.Service.Oidb.Response; | ||
using Lagrange.Core.Utility.Extension; | ||
using ProtoBuf; | ||
|
||
namespace Lagrange.Core.Internal.Service.Action; | ||
|
||
[EventSubscribe(typeof(FetchGroupAtAllRemainEvent))] | ||
[Service("OidbSvcTrpcTcp.0x8a7_0")] | ||
internal class FetchGroupAtAllRemainService : BaseService<FetchGroupAtAllRemainEvent> | ||
{ | ||
protected override bool Build(FetchGroupAtAllRemainEvent input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out Span<byte> output, out List<Memory<byte>>? extraPackets) | ||
{ | ||
var packet = new OidbSvcTrpcTcpBase<OidbSvcTrpcTcp0x8A7_0>(new OidbSvcTrpcTcp0x8A7_0 | ||
{ | ||
SubCmd = 1, | ||
LimitIntervalTypeForUin = 2, | ||
LimitIntervalTypeForGroup = 1, | ||
Uin = keystore.Uin, | ||
GroupCode = input.GroupUin | ||
}); | ||
|
||
output = packet.Serialize(); | ||
extraPackets = null; | ||
return true; | ||
} | ||
|
||
protected override bool Parse(Span<byte> input, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device, | ||
out FetchGroupAtAllRemainEvent output, out List<ProtocolEvent>? extraEvents) | ||
{ | ||
var packet = Serializer.Deserialize<OidbSvcTrpcTcpBase<OidbSvcTrpcTcp0x8A7_0Response>>(input); | ||
output = FetchGroupAtAllRemainEvent.Result((int)packet.ErrorCode, packet.Body.RemainAtAllCountForUin, packet.Body.RemainAtAllCountForGroup); | ||
extraEvents = null; | ||
return true; | ||
} | ||
} |