public Dictionary <string, Dictionary <string, Tuple <CrystariumType, Ability, int> > > GetNodes()
        {
            Dictionary <string, Dictionary <string, Tuple <CrystariumType, Ability, int> > > dict = new Dictionary <string, Dictionary <string, Tuple <CrystariumType, Ability, int> > >();

            RandoCrystarium.CharNames.ForEach(s => dict.Add(s, new Dictionary <string, Tuple <CrystariumType, Ability, int> >()));

            foreach (DataRow row in dataTable.Rows)
            {
                string         nodeId     = row.Field <string>(0);
                string         name       = row.Field <string>(1);
                CrystariumType type       = row.Field <string>(6) == "???" ? CrystariumType.Unknown : ((CrystariumType[])Enum.GetValues(typeof(CrystariumType)))[Enum.GetNames(typeof(CrystariumType)).ToList().IndexOf(row.Field <string>(6).Replace(" ", ""))];
                Ability        ability    = Abilities.abilities.Find(a => a.Name == GetAbilityName(row.Field <string>(7)));
                int            statAmount = row.Field <int>(8);
                if (!(type == CrystariumType.Unknown && ability == null))
                {
                    if (type == CrystariumType.Ability)
                    {
                        dict[name].Add(nodeId, new Tuple <CrystariumType, Ability, int>(type, ability, -1));
                    }
                    else if ((type == CrystariumType.HP || type == CrystariumType.Strength || type == CrystariumType.Magic) && statAmount > -1)
                    {
                        dict[name].Add(nodeId, new Tuple <CrystariumType, Ability, int>(type, null, statAmount));
                    }
                    else if (type == CrystariumType.Accessory || type == CrystariumType.ATBLevel || type == CrystariumType.RoleLevel)
                    {
                        dict[name].Add(nodeId, new Tuple <CrystariumType, Ability, int>(type, null, 0));
                    }
                    else if (ability != null)
                    {
                        dict[name].Add(nodeId, new Tuple <CrystariumType, Ability, int>(CrystariumType.Ability, ability, -1));
                    }
                }
            }
            return(dict);
        }
Example #2
0
 public void SetRemaining(List <DataStoreCrystarium> list)
 {
     foreach (string name in CharNames)
     {
         DataStoreWDB <DataStoreCrystarium, DataStoreIDCrystarium> crystarium = crystariums[name];
         foreach (DataStoreCrystarium c in list)
         {
             if (!(c.Type == CrystariumType.HP || c.Type == CrystariumType.Strength || c.Type == CrystariumType.Magic))
             {
                 int stage = c.Stage;
                 List <DataStoreCrystarium> others;
                 do
                 {
                     others = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }.SelectMany(t => crystarium.DataList.Where(o => o.Role == c.Role && o.Stage == stage && o.Type == t)).ToList();
                     stage--;
                 } while (others.Count == 0 && stage > 0);
                 if (others.Count > 0)
                 {
                     DataStoreCrystarium other = others[RandomNum.RandInt(0, others.Count - 1)];
                     c.Type  = other.Type;
                     c.Value = other.Value;
                 }
                 else
                 {
                     c.Type  = new CrystariumType[] { CrystariumType.HP, CrystariumType.Strength, CrystariumType.Magic }[RandomNum.RandInt(0, 2)];
                     c.Value = 1;
                 }
             }
         }
     }
 }
        public void SwapStats(DataStoreCrystarium other)
        {
            CrystariumType type  = other.Type;
            ushort         value = other.Value;

            other.Type  = this.Type;
            other.Value = this.Value;
            this.Type   = type;
            this.Value  = value;
        }