~ruther/NosSmooth

ref: 2490c12ccc03bf2aad6e3ad1f4236b2fef4e07cc NosSmooth/Core/NosSmooth.Game/Apis/NostaleMateSkillsPacketApi.cs -rw-r--r-- 2.7 KiB
2490c12c — Rutherther fix(game): make current partner and pet null if pinit does not contain them 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
//  NostaleMateSkillsPacketApi.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.Client;
using NosSmooth.Packets.Client.Battle;
using NosSmooth.Packets.Enums.Entities;
using Remora.Results;

namespace NosSmooth.Game.Apis;

/// <summary>
/// Packet api for using mate skills.
/// </summary>
public class NostaleMateSkillsPacketApi
{
    private readonly INostaleClient _client;

    /// <summary>
    /// Initializes a new instance of the <see cref="NostaleMateSkillsPacketApi"/> class.
    /// </summary>
    /// <param name="client">The client.</param>
    public NostaleMateSkillsPacketApi(INostaleClient client)
    {
        _client = client;
    }

    /// <summary>
    /// Use a pet skill.
    /// </summary>
    /// <param name="petId">The pet id.</param>
    /// <param name="targetEntityType">The type of the target entity.</param>
    /// <param name="targetId">The id of the target.</param>
    /// <param name="mapX">The x coordinate of the partner.</param>
    /// <param name="mapY">The y coordinate of the partner.</param>
    /// <returns>A result that may or may not have succeeded.</returns>
    public Task<Result> UsePetSkillAsync
    (
        long petId,
        EntityType targetEntityType,
        long targetId,
        short? mapX = default,
        short? mapY = default
    )
    {
        return _client.SendPacketAsync
        (
            new UsePetSkillPacket
            (
                petId,
                targetEntityType,
                targetId,
                1,
                mapX,
                mapY
            )
        );
    }

    /// <summary>
    /// Use a partner skill.
    /// </summary>
    /// <param name="partnerId">The pet id.</param>
    /// <param name="skillSlot">The slot of the skill.</param>
    /// <param name="targetEntityType">The type of the target entity.</param>
    /// <param name="targetId">The id of the target.</param>
    /// <param name="mapX">The x coordinate of the partner.</param>
    /// <param name="mapY">The y coordinate of the partner.</param>
    /// <returns>A result that may or may not have succeeded.</returns>
    public Task<Result> UsePartnerSkillAsync
    (
        long partnerId,
        byte skillSlot,
        EntityType targetEntityType,
        long targetId,
        short? mapX = default,
        short? mapY = default
    )
    {
        return _client.SendPacketAsync
        (
            new UsePartnerSkillPacket
            (
                partnerId,
                targetEntityType,
                targetId,
                skillSlot,
                mapX,
                mapY
            )
        );
    }
}
Do not follow this link