public static List<AttackPropertyModel> AttackPropertiesFromCommaList(string commaList, List<AttackPropertyModel> localContext = null )
        {
            var context = new NpcContext();
            var props = commaList.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
            var list = new List<AttackPropertyModel>();

            if (commaList.IsNullOrEmpty())
            {
                return list;
            }

            foreach (var prop in props)
            {
                var contextProps = localContext ?? context.AttackProperties.ToList();

                var attackProp = contextProps.FirstOrDefault(a => a.Name.ToLower().Equals(prop.Trim().ToLower()));

                list.Add(attackProp ?? new AttackPropertyModel(prop.Trim()));
            }

            return list;
        }
Esempio n. 2
0
 public RandomHelper(NpcContext context)
 {
     _context = context;
 }