diff --git a/PersonaProfile.cs b/PersonaProfile.cs index 2a80a57..df48b8e 100644 --- a/PersonaProfile.cs +++ b/PersonaProfile.cs @@ -3,13 +3,10 @@ namespace PersonaForge; public class PersonaProfile { public string Name { get; set; } = string.Empty; + public string Archetype { get; set; } = string.Empty; // Fandom Wiki calls them "Qualities," but I use the term "Traits" internally public PersonalityTraits Qualities { get; set; } = new(); - public static string ToJson(PersonalityTraits qualities, string name) => JsonSerializer.Serialize( - new PersonaProfile { Name = name, Qualities = qualities }, - new JsonSerializerOptions { WriteIndented = true } - ); - + public static string ToJson(PersonaProfile profile) => JsonSerializer.Serialize(profile, new JsonSerializerOptions { WriteIndented = true }); } diff --git a/Program.cs b/Program.cs index 6766ac9..c859975 100644 --- a/Program.cs +++ b/Program.cs @@ -3,6 +3,30 @@ using PersonaForge; -var traits = PersonalityGen.GenerateRandom(); -var profile = PersonaProfile.ToJson(traits, "John Doe"); -Console.WriteLine(profile); +Console.WriteLine("=== Welcome to The Sims 2 Personality Generator ==="); + +Console.Write("Enter Sim's name: "); +string name = Console.ReadLine() ?? "Unndanmed Sim"; + +var qualities = PersonalityGen.GenerateRandom(); +var profile = new PersonaProfile +{ + Name = name, + Qualities = qualities, + Archetype = "Random" +}; + +Console.WriteLine($"{name}'s Profile{Environment.NewLine}{PersonaProfile.ToJson(profile)}"); + +Console.Write("Save profile? (y/n): "); +var saveInput = Console.ReadLine()?.Trim().ToLowerInvariant(); + +if (saveInput == "y") +{ + var safeName = name.Replace(" ", "_").Replace("\"", ""); + File.WriteAllText($"{safeName}.json", PersonaProfile.ToJson(profile)); + Console.WriteLine($"Profile saved as {name}.json"); +} + +Console.WriteLine($"Done. Forge on! 🔥{Environment.NewLine}Press any key to exit..."); +Console.ReadKey(); diff --git a/README.md b/README.md index 542c89b..86ee6c9 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ With Sims 3 and later, creating personalities is as simple as selecting a trait. | ----- | ------------------------------------------- | ------ | | v0.1 | Core random point generator (working) | ✅ | | v0.2 | PersonalityProfile class | ✅ | -| v0.3 | JSON export | ✅ | +| v0.3 | Interactive JSON export | ✅ | | v0.4 | Archetypes with weighted biases | 🔜 | | v0.5 | Profile import/load from JSON | 🔜 | | v1.0 | Stable "Release" version with documentation | 🔜 |