diff --git a/AuroraRecordGenerator/Record.cs b/AuroraRecordGenerator/Record.cs index 1d94c70..8d0b461 100644 --- a/AuroraRecordGenerator/Record.cs +++ b/AuroraRecordGenerator/Record.cs @@ -22,11 +22,14 @@ namespace AuroraRecordGenerator [ProtoMember(5, IsRequired = true)] public SpeciesType Species { get; set; } = SpeciesType.Human; + [ProtoMember(16)] + public SpeciesSubType Subspecies { get; set; } = SpeciesSubType.None; + [ProtoMember(6, IsRequired = true)] public GenderType Gender { get; set; } [ProtoMember(7)] - public DateTime BirthDate { get; set; } = DateTime.Parse("1/1/2458"); + public DateTime BirthDate { get; set; } = Info.IcDate; [ProtoMember(8)] public double? CharHeight { get; set; } = 170; diff --git a/AuroraRecordGenerator/RecordEditor.xaml b/AuroraRecordGenerator/RecordEditor.xaml index 20ac1bc..000a573 100644 --- a/AuroraRecordGenerator/RecordEditor.xaml +++ b/AuroraRecordGenerator/RecordEditor.xaml @@ -16,7 +16,6 @@ - @@ -260,19 +259,19 @@ - - - - - + ()?.FieldName ?? "Subspecies"}: {Utility.SubspeciesNiceName(_targetRecord.Subspecies)}"); + } record.AppendLine(_targetRecord.Species.HasGender() ? $"Gender: {_targetRecord.Gender.Humanize()}" : "Gender: Not Applicable."); diff --git a/AuroraRecordGenerator/Types.cs b/AuroraRecordGenerator/Types.cs index 88ca55d..a932946 100644 --- a/AuroraRecordGenerator/Types.cs +++ b/AuroraRecordGenerator/Types.cs @@ -37,22 +37,22 @@ namespace AuroraRecordGenerator [ProtoEnum, SubspeciesMeta(SpeciesType.None, "N/A")] None = 0, - [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai")] + [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai", "Ethnicity")] MsaiTajara, - [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan")] + [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan", "Ethnicity")] ZhanTajara, - [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type A (Worker)")] + [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type A (Worker)", "Classification")] VaurcaWorker, - [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type B (Warrior)")] + [ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type B (Warrior)", "Classification")] VaurcaWarrior, - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell Frame")] + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell Frame", "Subtype")] IpcShell, - [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Industrial Frame")] + [ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Industrial Frame", "Subtype")] IpcG1Industrial } @@ -84,10 +84,12 @@ namespace AuroraRecordGenerator { public SpeciesType AssociatedSpecies {get; private set;} public string NiceName { get; private set; } - public SubspeciesMetaAttribute(SpeciesType associatedType, string nicename) + public string FieldName { get; private set; } + public SubspeciesMetaAttribute(SpeciesType associatedType, string nicename, string fieldname = "Subspecies") { AssociatedSpecies = associatedType; NiceName = nicename; + FieldName = fieldname; } } } \ No newline at end of file diff --git a/AuroraRecordGenerator/Utility.cs b/AuroraRecordGenerator/Utility.cs index 568cec5..9a58215 100644 --- a/AuroraRecordGenerator/Utility.cs +++ b/AuroraRecordGenerator/Utility.cs @@ -59,6 +59,14 @@ namespace AuroraRecordGenerator var attr = species.GetAttributeOfType(); return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species); } + + public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename) + { + return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast() + let attr = item.GetAttributeOfType() + where attr != null && attr.NiceName == nicename + select item).FirstOrDefault(); + } } // From https://stackoverflow.com/questions/1799370/getting-attributes-of-enums-value