Exemplo n.º 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))
     });
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public XElement ToXml(XmlData 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",
                                    data.ObjectDescs.Values.Where(_ => _.Skin && !_.NoSkinSelect).Select(_ => _.ObjectType).ToArray().ToCommaSepString()),
                       //ItemCosts.ToXml(data),
                       Lat == null ? null : new XElement("Lat", Lat),
                       Long == null ? null : new XElement("Long", Long),
                       MaxClassLevel.ToXml(data)
                       ));
 }