12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using System.Threading.Tasks;
- using MafiaTelegramBot.Resources;
- namespace MafiaTelegramBot.DataBase.Entity
- {
- [Table("opened_roles")]
- public class OpenedRolesEntity
- {
- [Key]
- [DatabaseGenerated(DatabaseGeneratedOption.None)]
- [Column("id"), MaxLength(127)] public long Id { get; init; }
- [Column("bodyguard") , MaxLength(127)] public bool Bodyguard { get; set; }
- [Column("dame") , MaxLength(127)] public bool Dame { get; set; }
- [Column("detective") , MaxLength(127)] public bool Detective { get; set; }
- [Column("elder") , MaxLength(127)] public bool Elder { get; set; }
- [Column("fool") , MaxLength(127)] public bool Fool { get; set; }
- [Column("hooker") , MaxLength(127)] public bool Hooker { get; set; }
- [Column("journalist") , MaxLength(127)] public bool Journalist { get; set; }
- [Column("lawyer") , MaxLength(127)] public bool Lawyer { get; set; }
- [Column("necromancer") , MaxLength(127)] public bool Necromancer { get; set; }
- [Column("parasite") , MaxLength(127)] public bool Parasite { get; set; }
- [Column("werewolf") , MaxLength(127)] public bool Werewolf { get; set; }
-
- public List<Roles> ToList()
- {
- var list = new List<Roles> {Roles.Don, Roles.Doctor, Roles.Cop};
- if(Bodyguard) list.Add(Roles.Bodyguard);
- if(Dame) list.Add(Roles.Dame);
- if(Detective) list.Add(Roles.Detective);
- if(Elder) list.Add(Roles.Elder);
- if(Fool) list.Add(Roles.Fool);
- if(Hooker) list.Add(Roles.Hooker);
- if(Journalist) list.Add(Roles.Journalist);
- if(Lawyer) list.Add(Roles.Lawyer);
- if(Necromancer) list.Add(Roles.Necromancer);
- if(Parasite) list.Add(Roles.Parasite);
- if(Werewolf) list.Add(Roles.Werewolf);
- return list;
- }
- public bool AllRolesOpened()
- {
- return Bodyguard && Dame && Detective
- && Elder && Fool && Hooker && Journalist
- && Lawyer && Necromancer && Parasite && Werewolf;
- }
- }
- }
|