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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116namespace Duets.Cli.Components.Commands
open Duets.Agents
open Duets.Cli.Components
open Duets.Cli.SceneIndex
open Duets.Cli.Text
open Duets.Common
open Duets.Entities
open Duets.Simulation
[<RequireQualifiedAccess>]
module MeCommand =
let private showCharacterInfo character =
let age = Queries.Characters.ageOf (State.get ()) character
Command.meName character.Name |> showMessage
Command.meBirthdayAge character.Birthday age |> showMessage
let private showCharacterAttributes _ =
Queries.Characters.allPlayableCharacterAttributes (State.get ())
|> List.map (fun (attr, amount) ->
(amount, Character.attributeName attr))
|> showBarChart
let private showCharacterMoodlets character =
let moodlets = Queries.Characters.moodlets character
let currentDate = Queries.Calendar.today (State.get ())
if Set.isEmpty moodlets then
Styles.faded "No moodlets affecting you right now" |> showMessage
else
moodlets
|> Set.iter (fun moodlet ->
let moodletName =
match moodlet.MoodletType with
| MoodletType.JetLagged -> "Jet lagged" |> Styles.warning
| MoodletType.NotInspired ->
"Not inspired" |> Styles.warning
| MoodletType.TiredOfTouring ->
"Tired of touring" |> Styles.warning
let moodletExplanation =
match moodlet.MoodletType with
| MoodletType.JetLagged ->
"You've traveled to a city with a very different timezone, you'll need some time to adjust. You might feel more tired than usual"
| MoodletType.NotInspired ->
"You've been composing too much lately, better take a break! Composing and improving songs while not inspired won't be as effective"
| MoodletType.TiredOfTouring ->
"You've been having too many concerts in the past few days, you need some rest! You won't be able to perform as well as usual"
let moodletExpirationText =
match moodlet.Expiration with
| MoodletExpirationTime.Never -> "Does not expire"
| MoodletExpirationTime.AfterDays days ->
let daysSinceStart =
Moodlet.daysSinceStart moodlet currentDate
let days = days - daysSinceStart
$"""Expires in {days} {Generic.simplePluralOf "day" days}"""
| MoodletExpirationTime.AfterDayMoments dayMoments ->
let dayMomentsSinceStart =
Moodlet.dayMomentsSinceStart moodlet currentDate
let dayMoments = dayMoments - dayMomentsSinceStart
$"""Expires after {dayMoments} {Generic.simplePluralOf "day moment" dayMoments}"""
|> Styles.faded
$"""{Emoji.moodlet moodlet.MoodletType} {moodletName} - {moodletExplanation}
{moodletExpirationText}"""
|> showMessage)
let private showCharacterSkills (character: Character) =
let skills =
Queries.Skills.characterSkillsWithLevel (State.get ()) character.Id
|> List.ofMapValues
if List.isEmpty skills then
Styles.faded "No skills learned yet" |> showMessage
else
skills
|> List.map (fun (skill, level) ->
(level, Skill.skillName skill.Id))
|> showBarChart
/// Command which displays the information of the playable character.
let get =
{ Name = "@me"
Description = Command.meDescription
Handler =
fun _ ->
let playableCharacter =
Queries.Characters.playableCharacter (State.get ())
Some "Character info" |> showSeparator
showCharacterInfo playableCharacter
Some "Attributes" |> showSeparator
showCharacterAttributes playableCharacter
Some "Moodlets" |> showSeparator
showCharacterMoodlets playableCharacter
Some "Skills" |> showSeparator
showCharacterSkills playableCharacter
showSeparator None
Scene.World }