Skip to content

Commit

Permalink
feat(BuyCommand): Implement IPredictable
Browse files Browse the repository at this point in the history
  • Loading branch information
Computerdores committed Apr 19, 2024
1 parent e34ba6f commit ab7917c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

namespace Computerdores.AdvancedTerminalAPI.Vanillin.Commands;

public class BuyCommand : ICommand, IAliasable {
public class BuyCommand : ICommand, IAliasable, IPredictable {
private bool _awaitingConfirmation;

private ICommand _command;

public string GetName() => "buy";

public string PredictInput(string partialInput, ITerminal terminal) {
return _awaitingConfirmation
? Util.PredictConfirmation(partialInput)
: FromPlayerInput(terminal.GetDriver().VanillaTerminal, partialInput).GetName();
}

public CommandResult Execute(string input, ITerminal terminal) {
if (_awaitingConfirmation) return _command.Execute(input, terminal);

Expand Down

0 comments on commit ab7917c

Please sign in to comment.