Skip to content

Commit

Permalink
Add label position option
Browse files Browse the repository at this point in the history
- user can now select to put the new label before or after the book name
- add hyphers into "One-Handed" and "Two-Handed"
  • Loading branch information
kjack9 committed May 7, 2021
1 parent 07ce535 commit 714d413
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
26 changes: 21 additions & 5 deletions BookSmart/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,18 @@ public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
{
Skill.HeavyArmor => "Heavy Armor",
Skill.LightArmor => "Light Armor",
Skill.OneHanded => "One Handed",
Skill.TwoHanded => "Two Handed",
Skill.OneHanded => "One-Handed",
Skill.TwoHanded => "Two-Handed",
_ => skillTeach.Skill.ToString()
};
newName = $"{open}{skillName}{close} {book.Name}";
switch (settings.labelPosition)
{
case Settings.LabelPosition.Before_Name: { newName = $"{open}{skillName}{close} {book.Name}"; break; }
case Settings.LabelPosition.After_Name: { newName = $"{book.Name} {open}{skillName}{close}"; break; }
default: throw new NotImplementedException("Somehow your set Label Position to something that isn't supported.");
}
}
// Label Format: Short
else if (settings.labelFormat == Settings.LabelFormat.Short)
Expand Down Expand Up @@ -96,12 +102,22 @@ public static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
_ => skillTeach.Skill.ToString()
};
newName = $"{open}{skillName}{close} {book.Name}";
switch (settings.labelPosition)
{
case Settings.LabelPosition.Before_Name: { newName = $"{open}{skillName}{close} {book.Name}"; break; }
case Settings.LabelPosition.After_Name: { newName = $"{book.Name} {open}{skillName}{close}"; break; }
default: throw new NotImplementedException("Somehow your set Label Position to something that isn't supported.");
}
}
// Label Format: Star
else if (settings.labelFormat == Settings.LabelFormat.Star)
{
newName = $"*{book.Name}";
switch (settings.labelPosition)
{
case Settings.LabelPosition.Before_Name: { newName = $"*{book.Name}"; break; }
case Settings.LabelPosition.After_Name: { newName = $"{book.Name}*"; break; }
default: throw new NotImplementedException("Somehow your set Label Position to something that isn't supported.");
}
}
else
{
Expand Down
13 changes: 13 additions & 0 deletions BookSmart/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace BookSmart
{
class Settings
{
// Label Format
public enum LabelFormat
{
Star,
Expand All @@ -24,6 +25,7 @@ public enum LabelFormat
[SynthesisTooltip("Star: *BookName\r\nShort: <Alch> BookName\r\nLong: <Alchemy> BookName")]
public LabelFormat labelFormat { get; set; } = LabelFormat.Long;

// Encapsulating Characters
public enum EncapsulatingCharacters
{
Parenthesis,
Expand All @@ -38,5 +40,16 @@ public enum EncapsulatingCharacters
[SynthesisTooltip("The characters to wrap the skill name in.\r\nParenthesis: ()\r\nCurly Brackets: {}\r\nSquare Brackets: []\r\nChevrons: <>\r\nStars: *")]
public EncapsulatingCharacters encapsulatingCharacters { get; set; } = EncapsulatingCharacters.Chevrons;

// Label Position
public enum LabelPosition
{
Before_Name,
After_Name
}

[SynthesisOrder]
[SynthesisSettingName("Label Position")]
[SynthesisTooltip("Where to put the label when creating the new name.")]
public LabelPosition labelPosition { get; set; } = LabelPosition.Before_Name;
}
}

0 comments on commit 714d413

Please sign in to comment.