~ruther/NosSmooth

4adbae32cf4976ff553b9f2e3b34a212e33676a2 — Rutherther 2 years ago a1fbfec
feat(packets): add packets for managing inventory
A Packets/NosSmooth.Packets/Client/Inventory/GetPacket.cs => Packets/NosSmooth.Packets/Client/Inventory/GetPacket.cs +28 -0
@@ 0,0 1,28 @@
//
//  GetPacket.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.Enums.Entities;
using NosSmooth.PacketSerializer.Abstractions.Attributes;

namespace NosSmooth.Packets.Client.Inventory;

/// <summary>
/// Pick up an item from ground.
/// </summary>
/// <param name="PickerEntityType">The type of the picker entity.</param>
/// <param name="PickerEntityId">The id of the picker entity.</param>
/// <param name="GroundItemId">The id of the ground item to pick up.</param>
[PacketHeader("get", PacketSource.Client)]
[GenerateSerializer(true)]
public record GetPacket
(
    [PacketIndex(0)]
    EntityType PickerEntityType,
    [PacketIndex(1)]
    long PickerEntityId,
    [PacketIndex(2)]
    long GroundItemId
) : IPacket;
\ No newline at end of file

A Packets/NosSmooth.Packets/Client/Inventory/MvePacket.cs => Packets/NosSmooth.Packets/Client/Inventory/MvePacket.cs +31 -0
@@ 0,0 1,31 @@
//
//  MvePacket.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.Enums.Inventory;
using NosSmooth.PacketSerializer.Abstractions.Attributes;

namespace NosSmooth.Packets.Client.Inventory;

/// <summary>
/// Move item from one bag to another (ie. from main to specialists)
/// </summary>
/// <param name="SourceBagType">The type of the source bag.</param>
/// <param name="SourceSlot">The slot in the source bag.</param>
/// <param name="DestinationBagType">The type of the destination bag.</param>
/// <param name="DestinationSlot">The destination slot.</param>
[PacketHeader("mve", PacketSource.Client)]
[GenerateSerializer(true)]
public record MvePacket
(
    [PacketIndex(0)]
    BagType SourceBagType,
    [PacketIndex(1)]
    short SourceSlot,
    [PacketIndex(2)]
    BagType DestinationBagType,
    [PacketIndex(3)]
    short DestinationSlot
) : IPacket;
\ No newline at end of file

A Packets/NosSmooth.Packets/Client/Inventory/MviPacket.cs => Packets/NosSmooth.Packets/Client/Inventory/MviPacket.cs +31 -0
@@ 0,0 1,31 @@
//
//  MviPacket.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.Enums.Inventory;
using NosSmooth.PacketSerializer.Abstractions.Attributes;

namespace NosSmooth.Packets.Client.Inventory;

/// <summary>
/// Move item in a bag from one position to another (swap items).
/// </summary>
/// <param name="BagType">The type of the bag to move items in.</param>
/// <param name="SourceSlot">The source slot.</param>
/// <param name="Amount">The amount to move.</param>
/// <param name="DestinationSlot">The destination slot.</param>
[PacketHeader("mvi", PacketSource.Client)]
[GenerateSerializer(true)]
public record MviPacket
(
    [PacketIndex(0)]
    BagType BagType,
    [PacketIndex(1)]
    short SourceSlot,
    [PacketIndex(2)]
    short Amount,
    [PacketIndex(3)]
    short DestinationSlot
) : IPacket;
\ No newline at end of file

A Packets/NosSmooth.Packets/Client/Inventory/PutPacket.cs => Packets/NosSmooth.Packets/Client/Inventory/PutPacket.cs +25 -0
@@ 0,0 1,25 @@
//
//  PutPacket.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.Enums.Inventory;
using NosSmooth.PacketSerializer.Abstractions.Attributes;

namespace NosSmooth.Packets.Client.Inventory;

/// <summary>
/// Drop an item from inventory.
/// </summary>
[PacketHeader("put", PacketSource.Client)]
[GenerateSerializer(true)]
public record PutPacket
(
    [PacketIndex(0)]
    BagType BagType,
    [PacketIndex(1)]
    short Slot,
    [PacketIndex(2)]
    short Amount
) : IPacket;
\ No newline at end of file

A Packets/NosSmooth.Packets/Client/Inventory/UseItemPacket.cs => Packets/NosSmooth.Packets/Client/Inventory/UseItemPacket.cs +25 -0
@@ 0,0 1,25 @@
//
//  UseItemPacket.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.Enums.Inventory;
using NosSmooth.PacketSerializer.Abstractions.Attributes;

namespace NosSmooth.Packets.Client.Inventory;

/// <summary>
/// Use an item from inventory.
/// </summary>
/// <param name="BagType">The type of the bag.</param>
/// <param name="Slot">The slot in the bag.</param>
[PacketHeader("u_i", PacketSource.Client)]
[GenerateSerializer(true)]
public record UseItemPacket
(
    [PacketIndex(0)]
    BagType BagType,
    [PacketIndex(1)]
    short Slot
) : IPacket;
\ No newline at end of file

Do not follow this link