Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deploy/portainer-stack.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
beacon-server:
image: beacon-server:0.1.2
image: beacon-server:0.1.7
restart: always
environment:
ASPNETCORE_ENVIRONMENT: Production
Expand Down Expand Up @@ -59,7 +59,7 @@ services:
/bin/sh -c '(while sleep 86400; do nginx -s reload; done) & exec nginx -g "daemon off;"'

beacon-backup:
image: beacon-backup:0.1.2
image: beacon-backup:0.1.7
restart: always
environment:
BACKUP_INTERVAL_SECONDS: "86400"
Expand Down
2 changes: 1 addition & 1 deletion docs/ROADMAP-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ that makes the addition cheap.
```
ProfileEntity
Id, AccountId, CharacterName, WorldId
DisplayName, Pronouns, Age, Race, Occupation
DisplayName, Age, Race, Occupation
Appearance, Personality, Background (long text)
Hooks (short "what you could approach me about" lines)
PortraitImageId -> reuses BeaconImageEntity's storage
Expand Down
2 changes: 1 addition & 1 deletion src/Beacon.Plugin/Beacon.Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- Drives the built DLL, the generated manifest, and the folder Dalamud loads it from. -->
<AssemblyName>Beacon</AssemblyName>
<RootNamespace>Beacon</RootNamespace>
<Version>0.1.6.0</Version>
<Version>0.1.7.0</Version>
<!-- The Dalamud SDK does not turn these on, and every service file wants System.Threading.Tasks. -->
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
10 changes: 0 additions & 10 deletions src/Beacon.Plugin/UI/ProfileLabels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ public static class ProfileLabels
+ "Plenty of people want this and want nothing to do with the explicit tag.",
};

public static string Describe(AgeRange age) => age switch
{
AgeRange.YoungAdult => "Young adult",
AgeRange.Adult => "Adult",
AgeRange.MiddleAged => "Middle-aged",
AgeRange.Elder => "Elder",
AgeRange.Ageless => "Ageless",
_ => "Unsaid",
};

public static string Describe(GalleryCategory category) => category switch
{
GalleryCategory.FullBody => "Full body",
Expand Down
7 changes: 2 additions & 5 deletions src/Beacon.Plugin/Windows/ChronicleWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,8 @@ private void DrawCardContents(ProfileDto profile, float scale)
if (!string.IsNullOrWhiteSpace(profile.Identity.Lineage))
details.Add(profile.Identity.Lineage);

if (profile.Identity.Age != AgeRange.Unspecified)
details.Add(ProfileLabels.Describe(profile.Identity.Age));

if (!string.IsNullOrWhiteSpace(profile.Identity.Pronouns))
details.Add(profile.Identity.Pronouns!);
if (profile.Identity.Age is { } age)
details.Add($"Age {age}");

if (details.Count > 0)
Ornament.Text(Theme.InkSoft, string.Join(" · ", details));
Expand Down
44 changes: 20 additions & 24 deletions src/Beacon.Plugin/Windows/ProfileEditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ public sealed class ProfileEditorWindow : Window, IDisposable
private string race = string.Empty;
private string clan = string.Empty;
private string gender = string.Empty;
private string pronouns = string.Empty;
private string quote = string.Empty;
private readonly string[] archetype = ["", "", ""];
private AgeRange age = AgeRange.Unspecified;
private string age = string.Empty;

private readonly HashSet<PersonalityTrait> traits = [];
private readonly HashSet<RpTone> tones = [];
Expand Down Expand Up @@ -139,10 +138,9 @@ public void Open(ProfileDto? profile)
race = appearance.Race ?? string.Empty;
clan = appearance.Clan ?? string.Empty;
gender = appearance.Gender ?? string.Empty;
pronouns = string.Empty;
quote = string.Empty;
Array.Fill(archetype, string.Empty);
age = AgeRange.Unspecified;
age = string.Empty;

length = RpLength.Casual;
boundaries = string.Empty;
Expand All @@ -164,9 +162,8 @@ public void Open(ProfileDto? profile)
race = identity.Race ?? string.Empty;
clan = identity.Clan ?? string.Empty;
gender = identity.Gender ?? string.Empty;
pronouns = identity.Pronouns ?? string.Empty;
quote = identity.Quote ?? string.Empty;
age = identity.Age;
age = identity.Age?.ToString() ?? string.Empty;

for (var i = 0; i < archetype.Length; i++)
archetype[i] = i < identity.Archetype.Count ? identity.Archetype[i] : string.Empty;
Expand Down Expand Up @@ -432,24 +429,10 @@ private void DrawCharacter(float scale)

ImGui.SetNextItemWidth(half);
ImGui.InputTextWithHint("##gender", "Gender", ref gender, 32);
ImGui.SameLine(0, 8f * scale);
ImGui.SetNextItemWidth(half);
ImGui.InputTextWithHint("##pronouns", "Pronouns", ref pronouns, 32);

Ornament.PageLabel("Age");
ImGui.SetNextItemWidth(half);
if (ImGui.BeginCombo("##age", ProfileLabels.Describe(age)))
{
foreach (var option in Enum.GetValues<AgeRange>())
{
if (ImGui.Selectable(ProfileLabels.Describe(option), age == option))
age = option;
}

ImGui.EndCombo();
}

ImGui.SameLine();
Ornament.Text(Theme.MutedDeep, "A bracket, not a number.");
ImGui.InputTextWithHint("##age", "Age", ref age, 5, ImGuiInputTextFlags.CharsDecimal);

ImGui.Spacing();
Ornament.PageLabel("A line they might say");
Expand Down Expand Up @@ -781,6 +764,20 @@ private async Task SubmitAsync()
var characterName = editing?.CharacterName ?? location.CurrentCharacterName;
var worldId = editing?.WorldId ?? location.CurrentWorldId;

int? ageYears = null;
if (!string.IsNullOrWhiteSpace(age))
{
if (!int.TryParse(age, out var parsedAge)
|| parsedAge < ProfileLimits.AgeMin
|| parsedAge > ProfileLimits.AgeMax)
{
validationError = $"Age must be between {ProfileLimits.AgeMin} and {ProfileLimits.AgeMax}.";
return;
}

ageYears = parsedAge;
}

if (string.IsNullOrWhiteSpace(characterName) || worldId == 0)
{
validationError = "Beacon cannot tell which character this is. Wait until you have loaded in.";
Expand All @@ -802,9 +799,8 @@ private async Task SubmitAsync()
Title = Blank(title),
Race = Blank(race),
Clan = Blank(clan),
Age = age,
Age = ageYears,
Gender = Blank(gender),
Pronouns = Blank(pronouns),
Archetype = archetype.Where(a => !string.IsNullOrWhiteSpace(a)).Select(a => a.Trim()).ToList(),
Quote = Blank(quote),
},
Expand Down
1 change: 0 additions & 1 deletion src/Beacon.Server/Data/BeaconDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ protected override void OnModelCreating(ModelBuilder b)
e.Property(x => x.Race).HasMaxLength(32);
e.Property(x => x.Clan).HasMaxLength(32);
e.Property(x => x.Gender).HasMaxLength(32);
e.Property(x => x.Pronouns).HasMaxLength(32);
e.Property(x => x.ArchetypeCsv).HasMaxLength(96);
e.Property(x => x.Quote).HasMaxLength(200);
e.Property(x => x.Boundaries).HasMaxLength(256);
Expand Down
4 changes: 1 addition & 3 deletions src/Beacon.Server/Data/Entities/ProfileEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ public class ProfileEntity

public string? Clan { get; set; }

public AgeRange Age { get; set; }
public int? Age { get; set; }

public string? Gender { get; set; }

public string? Pronouns { get; set; }

/// <summary>The three archetype words, pipe-delimited. Not searched, so no join table needed.</summary>
public string ArchetypeCsv { get; set; } = string.Empty;

Expand Down
Loading
Loading