Example #1
0
 public static CharList FromDb(Database db, DbAccount acc)
 {
     return(new CharList()
     {
         Characters = db.GetAliveCharacters(acc)
                      .Select(x => Character.FromDb(db.LoadCharacter(acc, x), false))
                      .ToArray(),
         NextCharId = acc.NextCharId,
         MaxNumChars = acc.MaxCharSlot,
         Account = Account.FromDb(acc),
         News = GetItems(db, acc),
         ClassAvailabilityList = ClassAvailabilityList.FromDb(acc, new DbClassAvailability(acc))
     });
 }
Example #2
0
        public static ClassAvailabilityList FromDb(DbAccount acc, DbClassAvailability ca)
        {
            var ret = new ClassAvailabilityList()
            {
                entries = new Dictionary <ushort, ClassAvailabilityEntry>()
            };

            foreach (var i in ca.AllKeys)
            {
                var type  = ushort.Parse(i);
                var entry = ClassAvailabilityEntry.FromDb(ca[type]);
                ret.entries[type] = entry;
            }
            return(ret);
        }
Example #3
0
 public XElement ToXml(EmbeddedData data, DbAccount acc)
 {
     return
         (new XElement("Chars",
                       new XAttribute("nextCharId", NextCharId),
                       new XAttribute("maxNumChars", MaxNumChars),
                       Characters.Select(x => x.ToXml()),
                       Account.ToXml(),
                       new XElement("News",
                                    News.Select(x => x.ToXml())
                                    ),
                       new XElement("Servers",
                                    Servers.Select(x => x.ToXml())
                                    ),
                       ClassAvailabilityList.ToXml(),
                       new XElement("OwnedSkins", Utils.GetCommaSepString(acc.OwnedSkins.ToArray())),
                       Lat == null ? null : new XElement("Lat", Lat),
                       Long == null ? null : new XElement("Long", Long),
                       MaxClassLevel.ToXml(data),
                       ItemCosts.ToXml()
                       ));
 }