public static FameListEntry FromDb(DbChar character) { var death = new DbDeath(character.Account, character.CharId); return(new FameListEntry() { AccountId = character.Account.AccountId, CharId = character.CharId, Name = character.Account.Name, ObjectType = character.ObjectType, Tex1 = character.Tex1, Tex2 = character.Tex2, Equipment = character.Items, TotalFame = death.TotalFame }); }
private static IEnumerable <NewsItem> GetItems(Database db, DbAccount acc) { var news = new DbNews(db, 10).Entries .Select(x => NewsItem.FromDb(x)).ToArray(); var chars = db.GetDeadCharacters(acc).Take(10).Select(x => { var death = new DbDeath(acc, x); return(new NewsItem() { Icon = "fame", Title = $"Your {Program.GameData.ObjectTypeToId[death.ObjectType]} died at level {death.Level}", TagLine = $"You earned {death.TotalFame} glorious Fame", Link = $"fame:{death.CharId}", Date = death.DeathTime }); }); return(news.Concat(chars).OrderByDescending(x => x.Date)); }
public static Fame FromDb(DbChar character) { DbDeath death = new DbDeath(character.Account, character.CharId); if (death.IsNull) { return(null); } var stats = FameStats.Read(character.FameStats); return(new Fame() { Name = character.Account.Name, Character = Character.FromDb(character, !death.IsNull), Stats = stats, Bonuses = stats.GetBonuses(Program.GameData, character, death.FirstBorn), TotalFame = death.TotalFame, FirstBorn = death.FirstBorn, DeathTime = death.DeathTime, Killer = death.Killer }); }