M Core/NosSmooth.Game/Data/Characters/Character.cs => Core/NosSmooth.Game/Data/Characters/Character.cs +16 -5
@@ 19,11 19,6 @@ namespace NosSmooth.Game.Data.Characters;
public class Character : Player
{
/// <summary>
- /// Gets or sets whether the character can't move.
- /// </summary>
- public bool Stunned { get; set; }
-
- /// <summary>
/// Gets or sets the inventory of the character.
/// </summary>
public Inventory.Inventory? Inventory { get; set; }
@@ 78,4 73,20 @@ public class Character : Player
}
}
}
+
+ /// <summary>
+ /// Gets or sets the sp points of the player.
+ /// </summary>
+ /// <remarks>
+ /// Resets every day, max 10 000.
+ /// </remarks>
+ public int SpPoints { get; set; }
+
+ /// <summary>
+ /// Gets or sets the additional sp points of the player.
+ /// </summary>
+ /// <remarks>
+ /// Used if <see cref="SpPoints"/> are 0. Max 1 000 000
+ /// </remarks>
+ public int AdditionalSpPoints { get; set; }
}=
\ No newline at end of file
M Core/NosSmooth.Game/Extensions/ServiceCollectionExtensions.cs => Core/NosSmooth.Game/Extensions/ServiceCollectionExtensions.cs +2 -0
@@ 12,6 12,7 @@ using NosSmooth.Game.Events.Core;
using NosSmooth.Game.PacketHandlers.Characters;
using NosSmooth.Game.PacketHandlers.Entities;
using NosSmooth.Game.PacketHandlers.Map;
+using NosSmooth.Game.PacketHandlers.Specialists;
namespace NosSmooth.Game.Extensions;
@@ 49,6 50,7 @@ public static class ServiceCollectionExtensions
.AddPacketResponder<StatPacketResponder>()
.AddPacketResponder<StPacketResponder>()
.AddPacketResponder<CondPacketResponder>()
+ .AddPacketResponder<SpResponder>()
.AddPacketResponder<EqResponder>();
serviceCollection
A Core/NosSmooth.Game/PacketHandlers/Specialists/SpResponder.cs => Core/NosSmooth.Game/PacketHandlers/Specialists/SpResponder.cs +45 -0
@@ 0,0 1,45 @@
+//
+// SpResponder.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.Specialists;
+using Remora.Results;
+
+namespace NosSmooth.Game.PacketHandlers.Specialists;
+
+/// <summary>
+/// Responds to sp packet.
+/// </summary>
+public class SpResponder : IPacketResponder<SpPacket>
+{
+ private readonly Game _game;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SpResponder"/> class.
+ /// </summary>
+ /// <param name="game">The game.</param>
+ public SpResponder(Game game)
+ {
+ _game = game;
+ }
+
+ /// <inheritdoc />
+ public Task<Result> Respond(PacketEventArgs<SpPacket> packetArgs, CancellationToken ct = default)
+ {
+ var packet = packetArgs.Packet;
+ var character = _game.Character;
+
+ if (character is null)
+ {
+ return Task.FromResult(Result.FromSuccess());
+ }
+
+ character.SpPoints = packet.SpPoints;
+ character.AdditionalSpPoints = packet.AdditionalSpPoints;
+
+ return Task.FromResult(Result.FromSuccess());
+ }
+}<
\ No newline at end of file