// .NET 8 C# - Random Sims 2 Personality Allocator // Clear, minimal, portable, with basic validation. using PersonaForge; var rootCommand = new RootCommand("PersonaForge: Sims 2 Personality Generator"); var nameOption = new Option( name: "--name", description: "Enter a name for the Sim" ); var archetypeOption = new Option( name: "--archetype", description: "The archetype template to base traits on", getDefaultValue: () => "Random" ); var zodiacOption = new Option( name: "--zodiac", description: "Use zodiac signs instead of archetypes" ) { IsRequired = false }; var exportOption = new Option( name: "--export", description: "Export the generated profile to a file" ) { IsRequired = false }; rootCommand.AddOption(nameOption); rootCommand.AddOption(archetypeOption); rootCommand.AddOption(exportOption); rootCommand.SetHandler(async ( string name, string archetype, bool zodiac, bool export ) => { var archetypeDefs = Archetypes.LoadFromJson("archetypes.json"); var archetypeDict = new Dictionary>(); if (zodiac) archetypeDefs = Archetypes.LoadFromJson("zodiacs.json"); var traits = PersonalityGen.GenerateRandom(archetypeDict.GetValueOrDefault(archetype, new())); var profile = new PersonaProfile { Name = name, Qualities = traits, Archetype = archetype }; Console.WriteLine($"--- Generated Profile ---{Environment.NewLine}{PersonaProfile.ToJson(profile)}"); if (export) { var safeName = name.Replace(" ", "_").Replace("\"", ""); await File.WriteAllTextAsync($"{safeName}.json", PersonaProfile.ToJson(profile)); } }, nameOption, archetypeOption, zodiacOption, exportOption); return await rootCommand.InvokeAsync(args);