~ruther/NosSmooth

ref: d45a01445b7eeeb9fbbb8dc14c5e046612a765d0 NosSmooth/Samples/WalkCommands/Commands/CombatCommands.cs -rw-r--r-- 1.5 KiB
d45a0144 — František Boháček feat(localbinding): add follow and unfollow (attack) entity methods 3 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
//
//  CombatCommands.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.ChatCommands;
using NosSmooth.Core.Client;
using NosSmooth.LocalBinding.Objects;
using Remora.Commands.Attributes;
using Remora.Commands.Groups;
using Remora.Results;

namespace WalkCommands.Commands;

/// <summary>
/// Represents command group for combat commands.
/// </summary>
public class CombatCommands : CommandGroup
{
    private readonly SceneManagerBinding _sceneManagerBinding;
    private readonly FeedbackService _feedbackService;

    /// <summary>
    /// Initializes a new instance of the <see cref="CombatCommands"/> class.
    /// </summary>
    /// <param name="sceneManagerBinding">The scene manager binding.</param>
    /// <param name="feedbackService">The feedback service.</param>
    public CombatCommands(SceneManagerBinding sceneManagerBinding, FeedbackService feedbackService)
    {
        _sceneManagerBinding = sceneManagerBinding;
        _feedbackService = feedbackService;
    }

    /// <summary>
    /// Focus the given entity.
    /// </summary>
    /// <param name="entityId">The entity id to focus.</param>
    /// <returns>A task that may or may not have succeeded.</returns>
    [Command("focus")]
    public Task<Result> HandleFocusAsync(int entityId)
    {
        return Task.FromResult(_sceneManagerBinding.FocusEntity(entityId));
    }
}
Do not follow this link