M src/Anonymizer.CLI/Anonymizer.CLI.csproj => src/Anonymizer.CLI/Anonymizer.CLI.csproj +0 -2
@@ 13,8 13,6 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
- <PackageReference Include="NosSmooth.Packets" Version="3.3.3" />
- <PackageReference Include="NosSmooth.PacketSerializer" Version="2.2.3" />
</ItemGroup>
<ItemGroup>
M src/Anonymizer/Anonymizer.csproj => src/Anonymizer/Anonymizer.csproj +2 -2
@@ 9,8 9,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
- <PackageReference Include="NosSmooth.Packets" Version="3.3.3" />
- <PackageReference Include="NosSmooth.PacketSerializer" Version="2.2.3" />
+ <PackageReference Include="NosSmooth.Packets" Version="3.4.0" />
+ <PackageReference Include="NosSmooth.PacketSerializer" Version="2.2.4" />
<PackageReference Include="NosSmooth.PacketSerializer.Abstractions" Version="1.2.0" />
</ItemGroup>
M src/Anonymizer/Extensions/ServiceCollectionExtensions.cs => src/Anonymizer/Extensions/ServiceCollectionExtensions.cs +23 -0
@@ 12,7 12,10 @@ using NosSmooth.Packets;
using NosSmooth.Packets.Client;
using NosSmooth.Packets.Client.Battle;
using NosSmooth.Packets.Client.Inventory;
+using NosSmooth.Packets.Client.Mates;
using NosSmooth.Packets.Server.Battle;
+using NosSmooth.Packets.Server.Buffs;
+using NosSmooth.Packets.Server.Buffs.Generated;
using NosSmooth.Packets.Server.Character;
using NosSmooth.Packets.Server.Chat;
using NosSmooth.Packets.Server.Entities;
@@ 21,6 24,7 @@ using NosSmooth.Packets.Server.Groups;
using NosSmooth.Packets.Server.Inventory;
using NosSmooth.Packets.Server.Login;
using NosSmooth.Packets.Server.Maps;
+using NosSmooth.Packets.Server.Mates;
using NosSmooth.Packets.Server.Raids;
using NosSmooth.Packets.Server.UI;
@@ 53,6 57,25 @@ public static class ServiceCollectionExtensions
public static IServiceCollection AddBasicMovers(this IServiceCollection serviceCollection)
=> serviceCollection
.AddMover<BsPacketMover, BsPacket>()
+ .AddMover<BfEPacketMover, BfEPacket>()
+ .AddMover<CtPacketMover, CtPacket>()
+ .AddMover<DmPacketMover, DmPacket>()
+ .AddMover<RcPacketMover, RcPacket>()
+ .AddMover<BfPacketMover, BfPacket>()
+ .AddMover<SayiPacketMover, SayiPacket>()
+ .AddMover<SayitemtPacketMover, SayitemtPacket>()
+ .AddMover<SaytPacketMover, SaytPacket>()
+ .AddMover<SpkPacketMover, SpkPacket>()
+ .AddMover<RestPacketMover, RestPacket>()
+ .AddMover<RaidfhpPacketMover, RaidfhpPacket>()
+ .AddMover<RaidfmpPacketMover, RaidfmpPacket>()
+ .AddMover<CtlPacketMover, CtlPacket>()
+ .AddMover<SuctlPacketMover, SuctlPacket>()
+ .AddMover<PtctlPacketMover, PtctlPacket>()
+ .AddMover<ThrowPacketMover, ThrowPacket>()
+ .AddMover<TpPacketMover, TpPacket>()
+ .AddMover<CharScPacketMover, CharScPacket>()
+ .AddMover<DiePacketMover, DiePacket>()
.AddMover<CInfoPacketMover, CInfoPacket>()
.AddMover<CModePacketMover, CModePacket>()
.AddMover<CondPacketMover, CondPacket>()
M => +7 -16
@@ 20,32 20,23 @@ public class HeaderFilterOptions
"stat",
"say",
"spk",
"infoi",
"msgi",
"sayi",
"sayi2",
"sayitemt",
"sayit",
"sayit2",
"bn",
"inv",
"qslot",
"umi",
"msgi2",
"qnai2",
"die",
"throw",
"bf",
"bf_e",
"dm",
"finit",
"finfo",
"ptctl",
"suctl", // figure out what it does
"ct", // figure out what it does
};
/// <summary>
/// Gets or sets the headers to keep. Takes priority before remove headers.
/// </summary>
public IReadOnlyList<string>? KeepHeaders { get; set; } = null;
// rdlst, raid, raidmbf, raidbf, in, out, c_info, c_mode
}
\ No newline at end of file
A src/Anonymizer/Movers/Basic/BfEPacketMover.cs => src/Anonymizer/Movers/Basic/BfEPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// BfEPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Buffs;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class BfEPacketMover : AbstractMover<BfEPacket>
+{
+ /// <inheritdoc />
+ public override BfEPacket Move(IAnonymizer anonymizer, BfEPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/BfPacketMover.cs => src/Anonymizer/Movers/Basic/BfPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// BfPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Buffs;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class BfPacketMover : AbstractMover<BfPacket>
+{
+ /// <inheritdoc />
+ public override BfPacket Move(IAnonymizer anonymizer, BfPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
M src/Anonymizer/Movers/Basic/CInfoPacketMover.cs => src/Anonymizer/Movers/Basic/CInfoPacketMover.cs +10 -2
@@ 5,6 5,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using NosSmooth.Packets.Server.Character;
+using NosSmooth.PacketSerializer.Abstractions;
+using NosSmooth.PacketSerializer.Abstractions.Common;
namespace Anonymizer.Movers.Basic;
@@ 17,8 19,14 @@ public class CInfoPacketMover : AbstractMover<CInfoPacket>
{
CharacterId = anonymizer.AnonymizeId(packet.CharacterId),
Name = anonymizer.AnonymizeName(packet.Name),
- FamilyId = packet.FamilyId is null ? null : anonymizer.AnonymizeName(packet.FamilyId),
- FamilyName = packet.FamilyName is null ? null : anonymizer.AnonymizeName(packet.FamilyName),
+ FamilySubPacket = packet.FamilySubPacket.Value is null ? null : packet.FamilySubPacket with
+ {
+ Value = packet.FamilySubPacket.Value with
+ {
+ FamilyId = anonymizer.AnonymizeId(packet.FamilySubPacket.Value.FamilyId)
+ }
+ },
+ FamilyName = anonymizer.AnonymizeName(packet.FamilyName),
GroupId = packet.GroupId is null ? null : anonymizer.AnonymizeId(packet.GroupId.Value)
};
}=
\ No newline at end of file
A src/Anonymizer/Movers/Basic/CharScPacketMover.cs => src/Anonymizer/Movers/Basic/CharScPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// CharScPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Entities;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class CharScPacketMover : AbstractMover<CharScPacket>
+{
+ /// <inheritdoc />
+ public override CharScPacket Move(IAnonymizer anonymizer, CharScPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/CtPacketMover.cs => src/Anonymizer/Movers/Basic/CtPacketMover.cs +21 -0
@@ 0,0 1,21 @@
+//
+// CtPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Battle;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class CtPacketMover : AbstractMover<CtPacket>
+{
+ /// <inheritdoc />
+ public override CtPacket Move(IAnonymizer anonymizer, CtPacket packet)
+ => packet with
+ {
+ CasterEntityId = anonymizer.AnonymizeId(packet.CasterEntityId),
+ TargetEntityId = packet.TargetEntityId is null ? null : anonymizer.AnonymizeId(packet.TargetEntityId.Value)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/CtlPacketMover.cs => src/Anonymizer/Movers/Basic/CtlPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// CtlPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Mates;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class CtlPacketMover : AbstractMover<CtlPacket>
+{
+ /// <inheritdoc />
+ public override CtlPacket Move(IAnonymizer anonymizer, CtlPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/DiePacketMover.cs => src/Anonymizer/Movers/Basic/DiePacketMover.cs +23 -0
@@ 0,0 1,23 @@
+//
+// DiePacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Entities;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class DiePacketMover : AbstractMover<DiePacket>
+{
+ /// <inheritdoc />
+ public override DiePacket Move(IAnonymizer anonymizer, DiePacket packet)
+ {
+ return packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId),
+ TargetEntityId = anonymizer.AnonymizeId(packet.TargetEntityId)
+ };
+ }
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/DmPacketMover.cs => src/Anonymizer/Movers/Basic/DmPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// DmPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Battle;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class DmPacketMover : AbstractMover<DmPacket>
+{
+ /// <inheritdoc />
+ public override DmPacket Move(IAnonymizer anonymizer, DmPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/FinfoPacketMover.cs => src/Anonymizer/Movers/Basic/FinfoPacketMover.cs +27 -0
@@ 0,0 1,27 @@
+//
+// FinfoPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Relations;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class FinfoPacketMover : AbstractMover<FInfoPacket>
+{
+ /// <inheritdoc />
+ public override FInfoPacket Move(IAnonymizer anonymizer, FInfoPacket packet)
+ => packet with
+ {
+ FriendSubPackets = packet.FriendSubPackets.Select
+ (
+ x => x with
+ {
+ PlayerId = anonymizer.AnonymizeId(x.PlayerId),
+ Name = anonymizer.AnonymizeName(x.Name)
+ }
+ ).ToArray()
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/FinitPacketMover.cs => src/Anonymizer/Movers/Basic/FinitPacketMover.cs +27 -0
@@ 0,0 1,27 @@
+//
+// FinitPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Relations;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class FinitPacketMover : AbstractMover<FInitPacket>
+{
+ /// <inheritdoc />
+ public override FInitPacket Move(IAnonymizer anonymizer, FInitPacket packet)
+ => packet with
+ {
+ FriendSubPackets = packet.FriendSubPackets.Select
+ (
+ x => x with
+ {
+ Name = anonymizer.AnonymizeName(x.Name),
+ PlayerId = anonymizer.AnonymizeId(x.PlayerId)
+ }
+ ).ToArray()
+ };
+}<
\ No newline at end of file
M src/Anonymizer/Movers/Basic/GidxPacketMover.cs => src/Anonymizer/Movers/Basic/GidxPacketMover.cs +1 -1
@@ 22,7 22,7 @@ public class GidxPacketMover : AbstractMover<GidxPacket>
{
Value = packet.FamilySubPacket.Value is null ? null : packet.FamilySubPacket.Value with
{
- FamilyId = anonymizer.AnonymizeName(packet.FamilySubPacket.Value.FamilyId)
+ FamilyId = anonymizer.AnonymizeId(packet.FamilySubPacket.Value.FamilyId)
}
}
};
M src/Anonymizer/Movers/Basic/InPacketMover.cs => src/Anonymizer/Movers/Basic/InPacketMover.cs +1 -1
@@ 35,7 35,7 @@ public class InPacketMover : AbstractMover<InPacket>
? null
: packet.PlayerSubPacket.FamilySubPacket.Value with
{
- FamilyId = anonymizer.AnonymizeName
+ FamilyId = anonymizer.AnonymizeId
(packet.PlayerSubPacket.FamilySubPacket.Value.FamilyId)
}
}
M src/Anonymizer/Movers/Basic/PinitPacketMover.cs => src/Anonymizer/Movers/Basic/PinitPacketMover.cs +1 -1
@@ 17,7 17,7 @@ public class PinitPacketMover : AbstractMover<PinitPacket>
{
return packet with
{
- PinitSubPackets = packet.PinitSubPackets?.Select
+ PinitSubPackets = packet.PinitSubPackets.Select
(
x => x with
{
A src/Anonymizer/Movers/Basic/PtctlPacketMover.cs => src/Anonymizer/Movers/Basic/PtctlPacketMover.cs +26 -0
@@ 0,0 1,26 @@
+//
+// PtctlPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Client.Mates;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class PtctlPacketMover : AbstractMover<PtctlPacket>
+{
+ /// <inheritdoc />
+ public override PtctlPacket Move(IAnonymizer anonymizer, PtctlPacket packet)
+ => packet with
+ {
+ Controls = packet.Controls.Select
+ (
+ x => x with
+ {
+ MateTransportId = anonymizer.AnonymizeId(x.MateTransportId)
+ }
+ ).ToArray()
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/RaidfhpPacketMover.cs => src/Anonymizer/Movers/Basic/RaidfhpPacketMover.cs +26 -0
@@ 0,0 1,26 @@
+//
+// RaidfhpPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Raids;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class RaidfhpPacketMover : AbstractMover<RaidfhpPacket>
+{
+ /// <inheritdoc />
+ public override RaidfhpPacket Move(IAnonymizer anonymizer, RaidfhpPacket packet)
+ => packet with
+ {
+ HpSubPackets = packet.HpSubPackets.Select
+ (
+ x => x with
+ {
+ PlayerId = anonymizer.AnonymizeId(x.PlayerId)
+ }
+ ).ToArray()
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/RaidfmpPacketMover.cs => src/Anonymizer/Movers/Basic/RaidfmpPacketMover.cs +26 -0
@@ 0,0 1,26 @@
+//
+// RaidfmpPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Raids;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class RaidfmpPacketMover : AbstractMover<RaidfmpPacket>
+{
+ /// <inheritdoc />
+ public override RaidfmpPacket Move(IAnonymizer anonymizer, RaidfmpPacket packet)
+ => packet with
+ {
+ HpSubPackets = packet.HpSubPackets.Select
+ (
+ x => x with
+ {
+ PlayerId = anonymizer.AnonymizeId(x.PlayerId)
+ }
+ ).ToArray()
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/RcPacketMover.cs => src/Anonymizer/Movers/Basic/RcPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// RcPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Battle;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class RcPacketMover : AbstractMover<RcPacket>
+{
+ /// <inheritdoc />
+ public override RcPacket Move(IAnonymizer anonymizer, RcPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/RestPacketMover.cs => src/Anonymizer/Movers/Basic/RestPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// RestPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.UI;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class RestPacketMover : AbstractMover<RestPacket>
+{
+ /// <inheritdoc />
+ public override RestPacket Move(IAnonymizer anonymizer, RestPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/Sayi2PacketMover.cs => src/Anonymizer/Movers/Basic/Sayi2PacketMover.cs +16 -0
@@ 0,0 1,16 @@
+//
+// Sayi2PacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Chat;
+
+namespace Anonymizer.Movers.Basic;
+
+/*
+public class Sayi2PacketMover : AbstractMover<Sayi2Packet>
+{
+
+}
+*/<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/SayiPacketMover.cs => src/Anonymizer/Movers/Basic/SayiPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// SayiPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Chat;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class SayiPacketMover : AbstractMover<SayiPacket>
+{
+ /// <inheritdoc />
+ public override SayiPacket Move(IAnonymizer anonymizer, SayiPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/SayitemtPacketMover.cs => src/Anonymizer/Movers/Basic/SayitemtPacketMover.cs +21 -0
@@ 0,0 1,21 @@
+//
+// SayitemtPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Chat;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class SayitemtPacketMover : AbstractMover<SayitemtPacket>
+{
+ /// <inheritdoc />
+ public override SayitemtPacket Move(IAnonymizer anonymizer, SayitemtPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId),
+ Name = anonymizer.AnonymizeName(packet.Name)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/SaytPacketMover.cs => src/Anonymizer/Movers/Basic/SaytPacketMover.cs +21 -0
@@ 0,0 1,21 @@
+//
+// SaytPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Chat;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class SaytPacketMover : AbstractMover<SaytPacket>
+{
+ /// <inheritdoc />
+ public override SaytPacket Move(IAnonymizer anonymizer, SaytPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId),
+ Name = anonymizer.AnonymizeName(packet.Name)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/SpkPacketMover.cs => src/Anonymizer/Movers/Basic/SpkPacketMover.cs +21 -0
@@ 0,0 1,21 @@
+//
+// SpkPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Chat;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class SpkPacketMover : AbstractMover<SpkPacket>
+{
+ /// <inheritdoc />
+ public override SpkPacket Move(IAnonymizer anonymizer, SpkPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId),
+ Name = anonymizer.AnonymizeName(packet.Name)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/SuctlPacketMover.cs => src/Anonymizer/Movers/Basic/SuctlPacketMover.cs +21 -0
@@ 0,0 1,21 @@
+//
+// SuctlPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Client.Mates;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class SuctlPacketMover : AbstractMover<SuctlPacket>
+{
+ /// <inheritdoc />
+ public override SuctlPacket Move(IAnonymizer anonymizer, SuctlPacket packet)
+ => packet with
+ {
+ MateTransportId = anonymizer.AnonymizeId(packet.MateTransportId),
+ TargetId = anonymizer.AnonymizeId(packet.TargetId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/ThrowPacketMover.cs => src/Anonymizer/Movers/Basic/ThrowPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// ThrowPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Maps;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class ThrowPacketMover : AbstractMover<ThrowPacket>
+{
+ /// <inheritdoc />
+ public override ThrowPacket Move(IAnonymizer anonymizer, ThrowPacket packet)
+ => packet with
+ {
+ DropId = anonymizer.AnonymizeId(packet.DropId)
+ };
+}<
\ No newline at end of file
A src/Anonymizer/Movers/Basic/TpPacketMover.cs => src/Anonymizer/Movers/Basic/TpPacketMover.cs +20 -0
@@ 0,0 1,20 @@
+//
+// TpPacketMover.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using NosSmooth.Packets.Server.Maps;
+
+namespace Anonymizer.Movers.Basic;
+
+/// <inheritdoc />
+public class TpPacketMover : AbstractMover<TpPacket>
+{
+ /// <inheritdoc />
+ public override TpPacket Move(IAnonymizer anonymizer, TpPacket packet)
+ => packet with
+ {
+ EntityId = anonymizer.AnonymizeId(packet.EntityId)
+ };
+}<
\ No newline at end of file
M src/Anonymizer/PacketProcessor.cs => src/Anonymizer/PacketProcessor.cs +8 -9
@@ 82,18 82,17 @@ public class PacketProcessor
{
if (mover.ShouldHandle(packet))
{
- var movedPacket = mover.Move(_anonymizer, packet);
- var serializedResult = _packetSerializer.Serialize(movedPacket);
- if (!serializedResult.IsDefined(out var serialized))
- {
- return Result<ProcessedPacket>.FromError(serializedResult);
- }
-
- return new ProcessedPacket(packetInfo.Packet, serialized, true);
+ packet = mover.Move(_anonymizer, packet);
}
}
- return new ProcessedPacket(packetInfo.Packet, packetInfo.Packet, true);
+ var serializedResult = _packetSerializer.Serialize(packet);
+ if (!serializedResult.IsDefined(out var serialized))
+ {
+ return Result<ProcessedPacket>.FromError(serializedResult);
+ }
+
+ return new ProcessedPacket(packetInfo.Packet, serialized, true);
}
/// <summary>