A Extensions/NosSmooth.Extensions.Combat/Responders/CancelResponder.cs => Extensions/NosSmooth.Extensions.Combat/Responders/CancelResponder.cs +35 -0
@@ 0,0 1,35 @@
+//
+// CancelResponder.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.Core.Packets;
+using NosSmooth.Packets.Server.Skills;
+using Remora.Results;
+
+namespace NosSmooth.Extensions.Combat.Responders;
+
+/// <summary>
+/// Responds to cancel packet.
+/// </summary>
+public class CancelResponder : IPacketResponder<CancelPacket>
+{
+ private readonly CombatManager _combatManager;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CancelResponder"/> class.
+ /// </summary>
+ /// <param name="combatManager">The combat manager.</param>
+ public CancelResponder(CombatManager combatManager)
+ {
+ _combatManager = combatManager;
+ }
+
+ /// <inheritdoc />
+ public Task<Result> Respond(PacketEventArgs<CancelPacket> packetArgs, CancellationToken ct = default)
+ {
+ _combatManager.CancelSkillTokens();
+ return Task.FromResult(Result.FromSuccess());
+ }
+}<
\ No newline at end of file
A Extensions/NosSmooth.Extensions.Combat/Responders/SuResponder.cs => Extensions/NosSmooth.Extensions.Combat/Responders/SuResponder.cs +35 -0
@@ 0,0 1,35 @@
+//
+// SuResponder.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.Core.Packets;
+using NosSmooth.Packets.Server.Battle;
+using Remora.Results;
+
+namespace NosSmooth.Extensions.Combat.Responders;
+
+/// <summary>
+/// Responds to su packet.
+/// </summary>
+public class SuResponder : IPacketResponder<SuPacket>
+{
+ private readonly CombatManager _combatManager;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SuResponder"/> class.
+ /// </summary>
+ /// <param name="combatManager">The combat manager.</param>
+ public SuResponder(CombatManager combatManager)
+ {
+ _combatManager = combatManager;
+ }
+
+ /// <inheritdoc />
+ public Task<Result> Respond(PacketEventArgs<SuPacket> packetArgs, CancellationToken ct = default)
+ {
+ _combatManager.CancelSkillTokens();
+ return Task.FromResult(Result.FromSuccess());
+ }
+}<
\ No newline at end of file