summaryrefslogtreecommitdiff
path: root/server/lib/core/commands/use_fh_perks_command.dart
blob: b857e45c82108b62fff2b63a542faae4ea56428f (plain)
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
import '../game_methods.dart';
import '../state/game_state.dart';
import 'command_l10n.dart';

class UseFHPerksCommand extends Command {
  final String characterId;

  UseFHPerksCommand(this.characterId);

  @override
  void execute() {
    final Character? character = GameMethods.getCharacterByName(characterId);
    if (character != null) {
      character.flipUseFHPerks(stateAccess);
    }
  }

  @override
  String describe() {
    final Character? character = GameMethods.getCharacterByName(characterId);
    final charId = character?.id ?? characterId;
    final use = character?.characterState.useFHPerks ?? false;
    if (use) {
      return commandL10n.cmdUseFhPerks(charId);
    }
    return commandL10n.cmdDontUseFhPerks(charId);
  }
}