Example #1
0
        /// <summary>
        /// Parse item description text and extract any relevant stats
        /// </summary>
        /// <param name="description">Text to parse</param>
        /// <returns>Stats parsed from the description</returns>
        internal static ItemStatsInfo Parse(string description)
        {
            ItemStatsInfo info = new ItemStatsInfo();

            if (string.IsNullOrWhiteSpace(description))
            {
                return(info);
            }
            foreach (KeyValuePair <string, string> pair in ItemDescriptionParser.Stats)
            {
                string value     = ItemDescriptionParser.ParseSection(pair.Key, pair.Value, description);
                int    value_int = 0;
                if (string.IsNullOrWhiteSpace(value) || !int.TryParse(value, out value_int))
                {
                    continue;
                }
                info.SetValue(pair.Key, value_int);
            }
            return(info);
        }
Example #2
0
 private ItemStatsInfo ParseDescription(string description)
 {
     this.descriptionStats = ItemDescriptionParser.Parse(description);
     return(this.descriptionStats);
 }