25
25
26
26
using System ;
27
27
using System . Collections . Generic ;
28
+ using System . Globalization ;
28
29
using ForecasterText . Objects ;
29
30
using ForecasterText . Objects . Enums ;
30
31
using GenericModConfigMenu ;
31
32
using StardewModdingAPI ;
33
+ using StardewValley ;
32
34
33
35
namespace ForecasterText {
34
36
public sealed class ForecasterConfigManager {
@@ -80,6 +82,27 @@ public void RegisterConfigManager(IGenericModConfigMenuApi configMenu) {
80
82
"When to show the weather for Ginger Island"
81
83
) ;
82
84
85
+ // When to display birthdays
86
+ this . AddSectionTitle (
87
+ "Show Birthdays" ,
88
+ "When to show birthday messages"
89
+ ) ;
90
+ this . AddBoolOption (
91
+ ( ) => this . ModConfig . ShowBirthdays ,
92
+ value => this . ModConfig . ShowBirthdays = value ,
93
+ "Show Birthdays" ,
94
+ "If birthdays are shown"
95
+ ) ;
96
+ this . AddBoolOption (
97
+ ( ) => this . ModConfig . UseVillagerNames ,
98
+ value => {
99
+ this . ModConfig . UseVillagerNames = value ;
100
+ this . Examples . ForEach ( message => message . Dirty = true ) ;
101
+ } ,
102
+ "Use Names" ,
103
+ "Shows names of villagers instead of their face icon"
104
+ ) ;
105
+
83
106
// When to display luck
84
107
this . AddSectionTitle (
85
108
"Show Luck" ,
@@ -185,6 +208,17 @@ public void RegisterConfigManager(IGenericModConfigMenuApi configMenu) {
185
208
message => this . RecipeExampleMessage ( message , true )
186
209
) ;
187
210
211
+ // Emoji for birthdays
212
+ this . AddSectionTitle (
213
+ "Birthday Icons" ,
214
+ "The icons used for birthdays"
215
+ ) ;
216
+ this . AddEmojiSelector ( "Birthday Today" , null ,
217
+ ( ) => this . ModConfig . BirthdayEmoji ,
218
+ i => this . ModConfig . BirthdayEmoji = i ,
219
+ message => this . BirthdayExampleMessage ( message , new [ ] { "Shane" , "Abigail" } )
220
+ ) ;
221
+
188
222
// Emojis for weather
189
223
this . AddSectionTitle (
190
224
"Weather Icons" ,
@@ -247,8 +281,8 @@ private void AddEmojiSelector(string text, string tooltip = null, Func<uint> get
247
281
// Unlike other types check if the config exists before constructing types
248
282
if ( this . ConfigMenu is { } config ) {
249
283
ConfigEmojiMenu menu = new ( this . Mod , text , tooltip , get , i => {
250
- this . Examples . ForEach ( message => message . Dirty = true ) ;
251
284
set ? . Invoke ( i ) ;
285
+ this . Examples . ForEach ( message => message . Dirty = true ) ;
252
286
} ) ;
253
287
254
288
if ( parser is not null ) {
@@ -285,7 +319,7 @@ private void AddParagraph(Func<string> text) =>
285
319
#endregion
286
320
#region Getters
287
321
288
- public uint GetEmoji ( WeatherIcons icon ) => icon switch {
322
+ public uint ? GetEmoji ( WeatherIcons icon ) => icon switch {
289
323
WeatherIcons . SUN => this . ModConfig . SunWeatherEmoji ,
290
324
WeatherIcons . RAIN => this . ModConfig . RainWeatherEmoji ,
291
325
WeatherIcons . LIGHTNING => this . ModConfig . ThunderWeatherEmoji ,
@@ -294,7 +328,7 @@ private void AddParagraph(Func<string> text) =>
294
328
WeatherIcons . WEDDING => this . ModConfig . WeddingWeatherEmoji ,
295
329
_ => 0u
296
330
} ;
297
- public uint GetEmoji ( SpiritMoods icon ) => icon switch {
331
+ public uint ? GetEmoji ( SpiritMoods icon ) => icon switch {
298
332
SpiritMoods . VERY_HAPPY => this . ModConfig . VeryHappySpiritEmoji ,
299
333
SpiritMoods . GOOD_HUMOR => this . ModConfig . GoodHumorSpiritEmoji ,
300
334
SpiritMoods . NEUTRAL => this . ModConfig . NeutralSpiritEmoji ,
@@ -303,18 +337,63 @@ private void AddParagraph(Func<string> text) =>
303
337
SpiritMoods . VERY_DISPLEASED => this . ModConfig . VeryDispleasedSpiritEmoji ,
304
338
_ => 0u
305
339
} ;
340
+ public uint ? GetEmoji ( Character character ) => character switch {
341
+ NPC npc => this . GetNpcEmoji ( npc . getName ( ) ) ,
342
+ _ => null
343
+ } ;
344
+ public uint ? GetNpcEmoji ( string name ) => name . ToLower ( CultureInfo . InvariantCulture ) switch {
345
+ "abigail" => 154u ,
346
+ "penny" => 155u ,
347
+ "maru" => 156u ,
348
+ "leah" => 157u ,
349
+ "haley" => 158u ,
350
+ "emily" => 159u ,
351
+ "alex" => 160u ,
352
+ "shane" => 161u ,
353
+ "sebastian" => 162u ,
354
+ "sam" => 163u ,
355
+ "harvey" => 164u ,
356
+ "elliot" => 165u ,
357
+ "sandy" => 166u ,
358
+ "evelyn" => 167u ,
359
+ "marnie" => 168u ,
360
+ "caroline" => 169u ,
361
+ "robin" => 170u ,
362
+ "pierre" => 171u ,
363
+ "pam" => 172u ,
364
+ "jodi" => 173u ,
365
+ "lewis" => 174u ,
366
+ "linus" => 175u ,
367
+ "marlon" => 176u ,
368
+ "willy" => 177u ,
369
+ "wizard" => 178u ,
370
+ "morris" => 179u ,
371
+ "jas" => 180u ,
372
+ "vincent" => 181u ,
373
+ "krobus" => 182u ,
374
+ "dwarf" => 183u ,
375
+ "gus" => 184u ,
376
+ "gunther" => 185u ,
377
+ "george" => 186u ,
378
+ "demestrius" => 187u ,
379
+ "clint" => 188u ,
380
+ _ => null
381
+ } ;
306
382
307
383
#endregion
308
384
#region Examples
309
385
310
386
internal string SpiritExampleMessage ( ConfigEmojiMessage message , SpiritMoods mood )
311
- => this . Mod . Events . GetDailyLuck ( mood ) ;
312
-
313
- internal string WeatherExampleMessage ( ConfigEmojiMessage message , WeatherIcons weatherDisplay )
314
- => this . Mod . Events . GetTownForecast ( ( int ) weatherDisplay ) ;
387
+ => this . Mod . Events . GetDailyLuck ( mood ) ? . ToString ( ) ;
315
388
316
389
internal string RecipeExampleMessage ( ConfigEmojiMessage message , bool hasRecipe )
317
- => this . Mod . Events . GetQueenOfSauce ( "Trout Soup" , hasRecipe ) ;
390
+ => this . Mod . Events . GetQueenOfSauce ( "Trout Soup" , hasRecipe ) ? . ToString ( ) ;
391
+
392
+ internal string BirthdayExampleMessage ( ConfigEmojiMessage message , IEnumerable < string > names )
393
+ => this . Mod . Events . GetBirthdays ( names ) ? . ToString ( ) ;
394
+
395
+ internal string WeatherExampleMessage ( ConfigEmojiMessage message , WeatherIcons weatherDisplay )
396
+ => this . Mod . Events . GetTownForecast ( ( int ) weatherDisplay ) ? . ToString ( ) ;
318
397
319
398
#endregion
320
399
}
0 commit comments