DnDCharacterSheets 1.0.2

dotnet add package DnDCharacterSheets --version 1.0.2
                    
NuGet\Install-Package DnDCharacterSheets -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DnDCharacterSheets" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DnDCharacterSheets" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="DnDCharacterSheets" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DnDCharacterSheets --version 1.0.2
                    
#r "nuget: DnDCharacterSheets, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DnDCharacterSheets@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DnDCharacterSheets&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=DnDCharacterSheets&version=1.0.2
                    
Install as a Cake Tool

DnDCharacterSheets

Dungeons and Dragons 5th Edition character sheets created in Blazor.

This is a port of the amazing ReactJS DnD Character sheets by Daryl Buckle https://github.com/DarylBuckle/dnd-character-sheets

<img width="600" alt="Screenshot 2020-09-06 at 19 35 55" src="https://user-images.githubusercontent.com/15156674/92332881-adbfee80-f078-11ea-8bcc-82cfb6484465.png">

Contents

About

Blazor components that render Dungeons & Dragons character sheets, namely a character stats sheet, character profile sheet and spell sheet.

The attributes in the example can be populated on the web page and outputs to print nicely, so you can populate some attributes on the page and print the sheet. Characters can also be exported to a json file and imported from a json file.

Install

dotnet add package DnDCharacterSheets

Usage

@page "/profile"
@using DnDCharacterSheets.Pages
@using DnDCharacterSheets
@inject SessionStorage storage;

<DnDCharacterProfileSheet Character="@character" CharacterChanged="SaveCharacter"/>

@code
{
    private DnDCharacter? character = new();
    protected override async Task OnInitializedAsync()
    {
        character = await storage.Read();
    }

    private void SaveCharacter(DnDCharacter character)
    {
        storage.Save(character);
    }
}

DnDCharacterStatsSheet renders a stats sheet.

DnDCharacterProfileSheet renders a character traits sheet.

DnDCharacterSpellSheet renders a spell sheet.

Property changes and notifications

Each component accesses the same base DTO DnDCharacter in the DnDCharacterSheets namespace. The class implements the INotifyPropertyChanged interface and raises an event PropertyChanged when any field is updated. Unlike the React implementation this has a drawback in terms of performance. You always get the complete DTO instead of single fields.

The changes are reflected in the Blazor component by using the CharacterChanged attribute. See example to utilise it for persisting the data.

DnDCharacter Class

The DnDCharacter class holds the attributes of a character. The attributes are shown below. I kept it almost compatible with the ReactJS version.

public class DnDCharacter
{
    string Name { get; set; }
    string ClassLevel { get; set; }
    string Background { get; set; }
    string PlayerName { get; set; }
    string Faction { get; set; }
    string Race { get; set; }
    string Alignment { get; set; }
    string Xp { get; set; }
    string DciNo { get; set; }
    int Str { get; set; }
    int Dex { get; set; }
    int Con { get; set; }
    int Wis { get; set; }
    int Cha { get; set; }
    int Inspiration { get; set; }
    int ProficiencyBonus { get; set; }
    int StrSave { get; set; }
    bool StrSaveChecked { get; set; }
    int DexSave { get; set; }
    bool DexSaveChecked { get; set; }
    int ConSave { get; set; }
    bool ConSaveChecked { get; set; }
    int IntSave { get; set; }
    bool IntSaveChecked { get; set; }
    int WisSave { get; set; }
    bool WisSaveChecked { get; set; }
    int ChaSave { get; set; }
    bool ChaSaveChecked { get; set; }
    int SkillAcrobatics { get; set; }
    bool SkillAcrobaticsChecked { get; set; }
    int SkillAnimalHandling { get; set; }
    bool SkillAnimalHandlingChecked { get; set; }
    int SkillArcana { get; set; }
    bool SkillArcanaChecked { get; set; }
    int SkillAthletics { get; set; }
    bool SkillAthleticsChecked { get; set; }
    int SkillDeception { get; set; }
    bool SkillDeceptionChecked { get; set; }
    int SkillHistory { get; set; }
    bool SkillHistoryChecked { get; set; }
    int SkillInsight { get; set; }
    bool SkillInsightChecked { get; set; }
    int SkillIntimidation { get; set; }
    bool SkillIntimidationChecked { get; set; }
    int SkillInvestigation { get; set; }
    bool SkillInvestigationChecked { get; set; }
    int SkillMedicine { get; set; }
    bool SkillMedicineChecked { get; set; }
    int SkillNature { get; set; }
    bool SkillNatureChecked { get; set; }
    int SkillPerception { get; set; }
    bool SkillPerceptionChecked { get; set; }
    int SkillPerformance { get; set; }
    bool SkillPerformanceChecked { get; set; }
    int SkillPersuasion { get; set; }
    bool SkillPersuasionChecked { get; set; }
    int SkillReligion { get; set; }
    bool SkillReligionChecked { get; set; }
    int SkillSlightOfHand { get; set; }
    bool SkillSlightOfHandChecked { get; set; }
    int SkillStealth { get; set; }
    bool SkillStealthChecked { get; set; }
    int SkillSurvival { get; set; }
    bool SkillSurvivalChecked { get; set; }
    int PassivePerception { get; set; }
    string OtherProficiencies { get; set; }
    int Ac { get; set; }
    int Init { get; set; }
    int Speed { get; set; }
    int MaxHp { get; set; }
    int Hp { get; set; }
    int TempHp { get; set; }
    string HitDiceMax { get; set; }
    string HitDice { get; set; }
    int DeathsaveSuccesses { get; set; }
    int DeathsaveFailures { get; set; }
    List<Attack> Attacks { get; set; }
    string AttacksText { get; set; }
    int CopperPieces { get; set; }
    int SilverPieces { get; set; }
    int EtherumPieces { get; set; }
    int GoldPieces { get; set; }
    int PlatinumPieces { get; set; }
    string Equipment { get; set; }
    string Equipment2 { get; set; }
    string PersonalityTraits { get; set; }
    string Ideals { get; set; }
    string Bonds { get; set; }
    string Flaws { get; set; }
    string FeaturesTraits { get; set; }
    int Age { get; set; }
    int Height { get; set; }
    int Weight { get; set; }
    string Eyes { get; set; }
    string Skin { get; set; }
    string Hair { get; set; }
    string Appearance { get; set; }
    string Backstory { get; set; }
    string FactionImg { get; set; }
    string FactionRank { get; set; }
    string Allies { get; set; }
    string Allies2 { get; set; }
    string AdditionalFeatures { get; set; }
    string AdditionalFeatures2 { get; set; }
    int TotalNonConsumableMagicItems { get; set; }
    string Treasure { get; set; }
    string Treasure2 { get; set; }
    string SpellcastingClass { get; set; }
    int PreparedSpellsTotal { get; set; }
    int SpellSaveDC { get; set; }
    int SpellAttackBonus { get; set; }
    List<Spell> Cantrips { get; set; }
    int Lvl1SpellSlotsTotal { get; set; }
    int Lvl1SpellSlotsUsed { get; set; }
    List<Spell> Lvl1Spells { get; set; }
    int Lvl2SpellSlotsTotal { get; set; }
    int Lvl2SpellSlotsUsed { get; set; }
    List<Spell> Lvl2Spells { get; set; }
    int Lvl3SpellSlotsTotal { get; set; }
    int Lvl3SpellSlotsUsed { get; set; }
    List<Spell> Lvl3Spells { get; set; }
    int Lvl4SpellSlotsTotal { get; set; }
    int Lvl4SpellSlotsUsed { get; set; }
    List<Spell> Lvl4Spells { get; set; }
    int Lvl5SpellSlotsTotal { get; set; }
    int Lvl5SpellSlotsUsed { get; set; }
    List<Spell> Lvl5Spells { get; set; }
    int Lvl6SpellSlotsTotal { get; set; }
    int Lvl6SpellSlotsUsed { get; set; }
    List<Spell> Lvl6Spells { get; set; }
    int Lvl7SpellSlotsTotal { get; set; }
    int Lvl7SpellSlotsUsed { get; set; }
    List<Spell> Lvl7Spells { get; set; }
    int Lvl8SpellSlotsTotal { get; set; }
    int Lvl8SpellSlotsUsed { get; set; }
    List<Spell> Lvl8Spells { get; set; }
    int Lvl9SpellSlotsTotal { get; set; }
    int Lvl9SpellSlotsUsed { get; set; }
    List<Spell> Lvl9Spells { get; set; }
}

License

MIT © Benjamin Giesinger 2022

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 931 11/6/2022
1.0.2-fix-preventevent0002 629 11/6/2022
1.0.1 846 11/3/2022
1.0.1-tags-1-0-0-0001 591 11/3/2022
1.0.1-fix-readme0001 674 11/3/2022
1.0.0-feat-workflow0045 615 11/3/2022
1.0.0-feat-workflow0044 684 11/3/2022
1.0.0-feat-workflow0043 624 11/3/2022
1.0.0-feat-workflow0040 630 11/3/2022