Going the UI route
This commit is contained in:
parent
970303d5ec
commit
9d9f951e9d
36 changed files with 822 additions and 4 deletions
2
PersonaForge.Console/GlobalUsing.cs
Normal file
2
PersonaForge.Console/GlobalUsing.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
global using System.Text.Json;
|
||||
global using System.CommandLine;
|
24
PersonaForge.Console/PersonaForge.Console.csproj
Normal file
24
PersonaForge.Console/PersonaForge.Console.csproj
Normal file
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<Version>0.5.103</Version>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackAsTool>true</PackAsTool>
|
||||
<ToolCommandName>personaforge</ToolCommandName>
|
||||
<PackageId>PersonaForge</PackageId>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PersonaForge\PersonaForge.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
68
PersonaForge.Console/Program.cs
Normal file
68
PersonaForge.Console/Program.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
// .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<string>(
|
||||
name: "--name",
|
||||
description: "Enter a name for the Sim"
|
||||
);
|
||||
|
||||
var archetypeOption = new Option<string>(
|
||||
name: "--archetype",
|
||||
description: "The archetype template to base traits on",
|
||||
getDefaultValue: () => "Random"
|
||||
);
|
||||
|
||||
var zodiacOption = new Option<bool>(
|
||||
name: "--zodiac",
|
||||
description: "Use zodiac signs instead of archetypes"
|
||||
)
|
||||
{ IsRequired = false };
|
||||
|
||||
var exportOption = new Option<bool>(
|
||||
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<string, Dictionary<string, double>>();
|
||||
|
||||
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);
|
72
PersonaForge.Console/archetypes.json
Normal file
72
PersonaForge.Console/archetypes.json
Normal file
|
@ -0,0 +1,72 @@
|
|||
[
|
||||
{
|
||||
"Name": "Social Butterfly",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 0.9,
|
||||
"Playful": 0.8,
|
||||
"Active": 0.6,
|
||||
"Nice": 0.7,
|
||||
"Neat": 0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Party Animal",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 0.9,
|
||||
"Playful": 0.8,
|
||||
"Active": 0.5,
|
||||
"Nice": 0.7,
|
||||
"Neat": 0.3
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Laidback",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 0.4,
|
||||
"Playful": 0.3,
|
||||
"Active": 0.4,
|
||||
"Nice": 0.8,
|
||||
"Neat": 0.4
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Grumpy",
|
||||
"TraitBiases": {
|
||||
"Nice": 0.2,
|
||||
"Playful": 0.4,
|
||||
"Outgoing": 0.6,
|
||||
"Neat": 0.7,
|
||||
"Active": 0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Artistic",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 0.3,
|
||||
"Playful": 0.7,
|
||||
"Active": 0.5,
|
||||
"Nice": 0.9,
|
||||
"Neat": 0.6
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Ambitious",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 0.6,
|
||||
"Playful": 0.4,
|
||||
"Active": 0.8,
|
||||
"Nice": 0.5,
|
||||
"Neat": 0.7
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Adventurous",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 0.8,
|
||||
"Playful": 0.8,
|
||||
"Active": 0.9,
|
||||
"Nice": 0.6,
|
||||
"Neat": 0.4
|
||||
}
|
||||
}
|
||||
]
|
11
PersonaForge.Console/profiles/Max_Casey.json
Normal file
11
PersonaForge.Console/profiles/Max_Casey.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"Name": "Max Casey",
|
||||
"Archetype": "Party Animal",
|
||||
"Qualities": {
|
||||
"Outgoing": 7,
|
||||
"Nice": 6,
|
||||
"Playful": 6,
|
||||
"Neat": 3,
|
||||
"Active": 3
|
||||
}
|
||||
}
|
11
PersonaForge.Console/profiles/Zack_Casey.json
Normal file
11
PersonaForge.Console/profiles/Zack_Casey.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"Name": "Zack Casey",
|
||||
"Archetype": "Laidback",
|
||||
"Qualities": {
|
||||
"Outgoing": 5,
|
||||
"Nice": 8,
|
||||
"Playful": 4,
|
||||
"Neat": 4,
|
||||
"Active": 4
|
||||
}
|
||||
}
|
122
PersonaForge.Console/zodiacs.json
Normal file
122
PersonaForge.Console/zodiacs.json
Normal file
|
@ -0,0 +1,122 @@
|
|||
[
|
||||
{
|
||||
"Name": "Aries",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 8.0,
|
||||
"Playful": 3.0,
|
||||
"Active": 7.0,
|
||||
"Nice": 3.0,
|
||||
"Neat": 4.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Taurus",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 4.0,
|
||||
"Playful": 4.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 7.0,
|
||||
"Neat": 6.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Gemini",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 7.0,
|
||||
"Playful": 7.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 3.0,
|
||||
"Neat": 4.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Cancer",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 4.0,
|
||||
"Playful": 3.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 8.0,
|
||||
"Neat": 6.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Leo",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 8.0,
|
||||
"Playful": 7.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 2.0,
|
||||
"Neat": 4.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Virgo",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 2.0,
|
||||
"Playful": 2.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 8.0,
|
||||
"Neat": 9.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Libra",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 8.0,
|
||||
"Playful": 6.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 5.0,
|
||||
"Neat": 2.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Scorpio",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 5.0,
|
||||
"Playful": 2.0,
|
||||
"Active": 8.0,
|
||||
"Nice": 4.0,
|
||||
"Neat": 6.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Sagittarius",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 7.0,
|
||||
"Playful": 7.0,
|
||||
"Active": 7.0,
|
||||
"Nice": 2.0,
|
||||
"Neat": 2.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Capricorn",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 3.0,
|
||||
"Playful": 2.0,
|
||||
"Active": 6.0,
|
||||
"Nice": 7.0,
|
||||
"Neat": 7.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Aquarius",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 6.0,
|
||||
"Playful": 7.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 5.0,
|
||||
"Neat": 3.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "Pisces",
|
||||
"TraitBiases": {
|
||||
"Outgoing": 4.0,
|
||||
"Playful": 8.0,
|
||||
"Active": 4.0,
|
||||
"Nice": 5.0,
|
||||
"Neat": 4.0
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue