1- using HtmlAgilityPack ;
1+ using System ;
2+ using HtmlAgilityPack ;
23using NetStone . Definitions . Model . Character ;
34
45namespace NetStone . Model . Parseables . Character ;
@@ -84,13 +85,13 @@ public CharacterAttributes(HtmlNode rootNode, CharacterAttributesDefinition defi
8485 /// This characters' Attack Magic Potency value.
8586 /// </summary>
8687 /// <remarks>This value is only set for disciples of war/magic.</remarks>
87- public int ? AttackMagicPotency => MpGpCpParameterName == "MP" ? int . Parse ( Parse ( this . definition . AttackMagicPotency ) ) : null ;
88+ public int ? AttackMagicPotency => IsDoWOrDoM ( ) ? this . AttackMagicPotencyInternal : null ;
8889
8990 /// <summary>
9091 /// This characters' Healing Magic Potency value.
9192 /// </summary>
9293 /// <remarks>This value is only set for disciples of war/magic.</remarks>
93- public int ? HealingMagicPotency => MpGpCpParameterName == "MP" ? int . Parse ( Parse ( this . definition . HealingMagicPotency ) ) : null ;
94+ public int ? HealingMagicPotency => IsDoWOrDoM ( ) ? this . HealingMagicPotencyInternal : null ;
9495
9596 /// <summary>
9697 /// This characters' Spell Speed value.
@@ -112,25 +113,25 @@ public CharacterAttributes(HtmlNode rootNode, CharacterAttributesDefinition defi
112113 /// This characters' Craftmanship value.
113114 /// </summary>
114115 /// <remarks>This value is only set for disciples of the hand.</remarks>
115- public int ? Craftmanship => MpGpCpParameterName == "CP" ? AttackMagicPotencyValue : null ;
116+ public int ? Craftsmanship => IsDoH ( ) ? this . AttackMagicPotencyInternal : null ;
116117
117118 /// <summary>
118119 /// This characters' Control value.
119120 /// </summary>
120121 /// <remarks>This value is only set for disciples of the hand.</remarks>
121- public int ? Control => MpGpCpParameterName == "CP" ? HealingMagicPotencyValue : null ;
122+ public int ? Control => IsDoH ( ) ? this . HealingMagicPotencyInternal : null ;
122123
123124 /// <summary>
124125 /// This characters' Gathering value.
125126 /// </summary>
126127 /// <remarks>This value is only set for disciples of the land.</remarks>
127- public int ? Gathering => MpGpCpParameterName == "GP" ? AttackMagicPotencyValue : null ;
128+ public int ? Gathering => IsDoL ( ) ? this . AttackMagicPotencyInternal : null ;
128129
129130 /// <summary>
130131 /// This characters' Perception value.
131132 /// </summary>
132133 /// <remarks>This value is only set for disciples of the land.</remarks>
133- public int ? Perception => MpGpCpParameterName == "GP" ? HealingMagicPotencyValue : null ;
134+ public int ? Perception => IsDoL ( ) ? this . HealingMagicPotencyInternal : null ;
134135
135136 /// <summary>
136137 /// This characters' HP value.
@@ -146,8 +147,12 @@ public CharacterAttributes(HtmlNode rootNode, CharacterAttributesDefinition defi
146147 /// Value indicating which of MP, GP, or CP is indicated by <see cref="MpGpCp"/>.
147148 /// </summary>
148149 public string MpGpCpParameterName => Parse ( this . definition . MpGpCpParameterName ) ;
150+
151+ internal bool IsDoL ( ) => this . MpGpCpParameterName . Equals ( "GP" , StringComparison . InvariantCultureIgnoreCase ) ;
152+ internal bool IsDoWOrDoM ( ) => this . MpGpCpParameterName . Equals ( "MP" , StringComparison . InvariantCultureIgnoreCase ) ;
153+ internal bool IsDoH ( ) => this . MpGpCpParameterName . Equals ( "CP" , StringComparison . InvariantCultureIgnoreCase ) ;
149154
150- private int AttackMagicPotencyValue => int . Parse ( Parse ( this . definition . AttackMagicPotency ) ) ;
151-
152- private int HealingMagicPotencyValue => int . Parse ( Parse ( this . definition . HealingMagicPotency ) ) ;
155+ internal int AttackMagicPotencyInternal => int . TryParse ( Parse ( this . definition . AttackMagicPotency ) , out var val ) ? val : 0 ;
156+
157+ internal int HealingMagicPotencyInternal => int . TryParse ( Parse ( this . definition . HealingMagicPotency ) , out var val ) ? val : 0 ;
153158}
0 commit comments