Ejemplo n.º 1
0
 public static async Task DynastyHub(Player player, Dynasty dynasty, DynastyMember membership, ISocketMessageChannel chan)
 {
     membership ??= dynasty.GetMember(player);
     await chan.SendMessageAsync(embed : dynasty.ToEmbed(
                                     dynasty.MemberField(membership)
                                     ).Build());
 }
Ejemplo n.º 2
0
        public static async Task <(Dynasty, DynastyMember, string)> Load(Player player)
        {
            if (player.dynasty == null)
            {
                return(null, null, "You are not in a Dynasty");
            }
            Dynasty dan = await Load(player.dynasty.id);

            if (dan == null)
            {
                player.dynasty = null;
                player.SaveFileMongo();
                return(dan, null, "Your dynasty was disbanded");
            }
            DynastyMember membership = dan.GetMember(player);

            if (membership == null)
            {
                player.dynasty = null;
                player.SaveFileMongo();
                return(dan, membership, "You were removed from the dynasty " + dan.name);
            }

            return(dan, membership, null);
        }
Ejemplo n.º 3
0
        public DynastyTicket(Dynasty dynasty, DynastyMember member)
        {
            id          = dynasty._id;
            dynastyName = dynasty.name;

            userId     = member.userId;
            memberRank = dynasty.rankNames[member.rank];
        }
Ejemplo n.º 4
0
        public DynastyMember GetMember(Player player)
        {
            DynastyMember member = GetMember(player._id);

            if (member != null)
            {
                player.dynasty.Update(this, member.rank);
            }
            return(member);
        }
Ejemplo n.º 5
0
        public async Task <DynastyMember> AddMemeber(Player player)
        {
            DynastyMember member = new DynastyMember(player.userid, player.name, rankNames.Length - 1);

            player.dynasty = new DynastyTicket(this, member);
            members.Add(member);
            await Save();

            player.SaveFileMongo();
            return(member);
        }
Ejemplo n.º 6
0
        private Dynasty(Player founder, string name)
        {
            _id          = new Guid();
            mainServerId = 0;
            this.name    = name;
            DynastyMember fMember = new DynastyMember(founder.userid, founder.name, 0);

            members = new List <DynastyMember>()
            {
                fMember
            };

            rankNames = new string[]
            {
                "Head", "Duke", "Baron", "Lord",
                "High Knight", "Knight", "Adventurer",
                "Squire", "Peasant"
            };

            founder.dynasty = new DynastyTicket(this, fMember);
            founder.KCoins -= DYNASTY_COST;
        }
Ejemplo n.º 7
0
 public EmbedField MemberField(DynastyMember membership)
 => DUtils.NewField($"{rankNames[membership.rank]} of the {name} Dynasty",
                    $"Member since {membership.joined.ToShortDateString()}"
                    ).Build();