Esempio n. 1
0
 public static EuIdeaGroupCategory GetExclusiveCategory(IdeaGroup group)
 {
     for (var i = 0; i < 8; i++)
     {
         var thisOne = _map[(EuIdeaGroupCategory)i];
         if (thisOne.Contains(group))
         {
             return((EuIdeaGroupCategory)i);
         }
     }
     throw new Exception(group + " was not found");
 }
Esempio n. 2
0
        public List <IdeaGroup> LoadIdeas(string folder, string[] except = null)
        {
            var fileNames = Directory.GetFiles(Path.Combine(folder, "common", "ideas"));

            if (except != null)
            {
                fileNames = fileNames.Where(x => !except.Any(y => x.EndsWith(y + ".json"))).ToArray();
            }
            var ideaGroups = new List <IdeaGroup>();

            foreach (var fileName in fileNames)
            {
                var obj = LoadObject(fileName);

                var ideaGroupProps = obj.Properties().Where(x => x.Name != "_filename");
                foreach (var ideaGroupProp in ideaGroupProps)
                {
                    var ideaGroupObj = (JObject)ideaGroupProp.Value;
                    var trigger      = LoadTrigger((JObject)ideaGroupObj["trigger"]);
                    var ideaProps    = ideaGroupObj.Properties()
                                       .Where(x => x.Name != "trigger" &&
                                              x.Name != "category" &&
                                              x.Name != "free" && x.Name != "important");
                    var ideaGroup = new IdeaGroup
                    {
                        Name     = ideaGroupProp.Name,
                        Category = ideaGroupObj.Value <string>("category"),
                        Ideas    = ideaProps.Select(x => new Idea
                        {
                            Name    = x.Name,
                            Bonuses = ((JObject)x.Value).Properties().ToDictionary(y => y.Name, y => y.Value.Value <string>())
                        }).ToList(),
                        Trigger = trigger,
                    };
                    ideaGroups.Add(ideaGroup);
                }
            }
            return(ideaGroups);
        }