Add skill groups and GM character owner transfer across stack

This commit is contained in:
2026-02-26 13:54:17 +01:00
parent bf3a6fa645
commit 04bc8095e6
31 changed files with 995 additions and 1180 deletions

View File

@@ -282,10 +282,12 @@ public partial class Workspace : IAsyncDisposable
CreateCharacterInitialModel = new()
{
Name = string.Empty,
CampaignId = SelectedCampaignId?.ToString() ?? string.Empty
CampaignId = SelectedCampaignId?.ToString() ?? string.Empty,
OwnerUsername = string.Empty
};
CreateCharacterFormVersion++;
CanEditCharacterOwner = false;
ShowCreateCharacterModal = true;
}
@@ -295,10 +297,12 @@ public partial class Workspace : IAsyncDisposable
EditCharacterInitialModel = new()
{
Name = character.Name,
CampaignId = character.CampaignId.ToString()
CampaignId = character.CampaignId.ToString(),
OwnerUsername = string.Empty
};
EditCharacterFormVersion++;
CanEditCharacterOwner = IsCurrentUserGm;
ShowEditCharacterModal = true;
}
@@ -306,6 +310,7 @@ public partial class Workspace : IAsyncDisposable
{
ShowCreateCharacterModal = false;
ShowEditCharacterModal = false;
CanEditCharacterOwner = false;
EditingCharacterId = null;
}
@@ -375,6 +380,18 @@ public partial class Workspace : IAsyncDisposable
SetStatus("Skill updated.", false);
}
private async Task OnSkillGroupCreatedAsync(Guid _)
{
await RefreshCampaignScopeAsync();
SetStatus("Skill group created.", false);
}
private async Task OnSkillGroupUpdatedAsync(Guid _)
{
await RefreshCampaignScopeAsync();
SetStatus("Skill group updated.", false);
}
private async Task RollSkillAsync(Guid skillId)
{
if (SelectedCampaign is null)
@@ -626,6 +643,7 @@ public partial class Workspace : IAsyncDisposable
LastRoll = null;
ShowCreateCharacterModal = false;
ShowEditCharacterModal = false;
CanEditCharacterOwner = false;
CreateCharacterInitialModel = new();
EditCharacterInitialModel = new();
CreateCharacterFormVersion = 0;
@@ -702,6 +720,7 @@ public partial class Workspace : IAsyncDisposable
private bool ShowCreateCharacterModal { get; set; }
private bool ShowEditCharacterModal { get; set; }
private bool CanEditCharacterOwner { get; set; }
private Guid? EditingCharacterId { get; set; }
private CharacterFormModel CreateCharacterInitialModel { get; set; } = new();
private CharacterFormModel EditCharacterInitialModel { get; set; } = new();
@@ -728,6 +747,9 @@ public partial class Workspace : IAsyncDisposable
private List<SkillSummary> SelectedCharacterSkills =>
SelectedCampaign is null || !SelectedCharacterId.HasValue ? [] : SelectedCampaign.Skills.Where(skill => skill.CharacterId == SelectedCharacterId.Value).OrderBy(skill => skill.Name, StringComparer.OrdinalIgnoreCase).ToList();
private List<SkillGroupSummary> SelectedCharacterSkillGroups =>
SelectedCampaign is null || !SelectedCharacterId.HasValue ? [] : SelectedCampaign.SkillGroups.Where(group => group.CharacterId == SelectedCharacterId.Value).OrderBy(group => group.Name, StringComparer.OrdinalIgnoreCase).ToList();
private bool IsPlayScreen => string.Equals(CurrentScreen, "play", StringComparison.OrdinalIgnoreCase);
private bool IsManagementScreen => !IsPlayScreen;
private string CurrentScreenLabel => IsPlayScreen ? "Play" : "Campaign Management";