Esempio n. 1
0
        public void RemoveShaman(string shamanId, string actingPlayer)
        {
            if (ChiefTain != actingPlayer)
            {
                throw new ValidationException("Only Chieftain can manage Shamans");
            }

            Shamans.Remove(shamanId);
            Members.Add(shamanId);
        }
Esempio n. 2
0
        public void RevokeInvite(ClanMembership clanMemberShip, string personWhoInvitesBattleTag)
        {
            if (ChiefTain != personWhoInvitesBattleTag && !Shamans.Contains(personWhoInvitesBattleTag))
            {
                throw new ValidationException("Only chieftains and shamans can invite");
            }

            clanMemberShip.RevokeInvite();

            PendingInvites.Remove(clanMemberShip.BattleTag);
        }
Esempio n. 3
0
        public void SwitchChieftain(string newChieftain, string actingPlayer)
        {
            if (ChiefTain != actingPlayer)
            {
                throw new ValidationException("Only Chieftain can switch to new Chieftain");
            }
            if (!Shamans.Contains(newChieftain))
            {
                throw new ValidationException("Only Shaman can be promoted to Chieftain");
            }

            Shamans.Remove(newChieftain);
            Shamans.Add(ChiefTain);
            ClanState.ChiefTain = newChieftain;
        }
Esempio n. 4
0
        public void KickPlayer(ClanMembership clanMemberShip, string actingPlayer)
        {
            if (ChiefTain != actingPlayer && !Shamans.Contains(actingPlayer))
            {
                throw new ValidationException("Only Chieftain or shamans can kick players");
            }
            if (!Members.Contains(clanMemberShip.BattleTag) && !Shamans.Contains(clanMemberShip.BattleTag))
            {
                throw new ValidationException("Player not in this clan");
            }
            if (clanMemberShip.BattleTag == ChiefTain)
            {
                throw new ValidationException("Can not kick chieftain");
            }

            clanMemberShip.LeaveClan();
            Members.Remove(clanMemberShip.BattleTag);
            Shamans.Remove(clanMemberShip.BattleTag);
        }
Esempio n. 5
0
        public void AddShaman(string shamanId, string actingPlayer)
        {
            if (ChiefTain != actingPlayer)
            {
                throw new ValidationException("Only Chieftain can manage Shamans");
            }
            if (!Members.Contains(shamanId))
            {
                throw new ValidationException("Shaman has to be in clan");
            }
            if (shamanId == ChiefTain)
            {
                throw new ValidationException("Chieftain can not be made Shaman");
            }
            if (Shamans.Contains(shamanId))
            {
                throw new ValidationException("Player is already Shaman");
            }

            Members.Remove(shamanId);
            Shamans.Add(shamanId);
        }
Esempio n. 6
0
        public void Invite(ClanMembership clanMemberShip, string personWhoInvitesBattleTag)
        {
            if (ChiefTain != personWhoInvitesBattleTag && !Shamans.Contains(personWhoInvitesBattleTag))
            {
                throw new ValidationException("Only chieftains and shamans can invite");
            }
            if (PendingInvites.Contains(clanMemberShip.BattleTag))
            {
                throw new ValidationException("Can not invite player twice");
            }
            if (Members.Contains(clanMemberShip.BattleTag))
            {
                throw new ValidationException("Can not invite player twice");
            }
            if (FoundingFathers.Contains(clanMemberShip.BattleTag))
            {
                throw new ValidationException("Can not invite player twice");
            }

            clanMemberShip.Invite(this);

            PendingInvites.Add(clanMemberShip.BattleTag);
        }