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); }
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; }
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); }
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); }
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); }