public void AddCharacter(string name, string faction, string race, string characterclass) { CharacterFaction cf; CharacterRace cr; CharacterClass cc; List<Character> characters = GetCharacter(); if(!Enum.TryParse<CharacterFaction>(faction, out cf)) { throw new Exception("Faction invalid"); } if(!Enum.TryParse<CharacterRace>(race, out cr)) { throw new Exception("Race invalid"); } if(!Enum.TryParse<CharacterClass>(characterclass, out cc)) { throw new Exception("Class invalid"); } if(characters.Count(x => x.Faction != cf && x.Active == true) > 0) { throw new Exception("All Characters must be part of the " + characters.First().Faction.ToString()); } Character newCharacter = new Character(name, cf, cr, cc); PlayerData p = new PlayerData(FileName); p.AddCharacter(UserName, newCharacter); }
public void EditCharacter(Guid id, string name, string faction, string race, string characterclass, short level, bool Active) { CharacterFaction cf; CharacterRace cr; CharacterClass cc; List<Character> characters = GetCharacter(); if (!Enum.TryParse<CharacterFaction>(faction, out cf)) { throw new Exception("Faction invalid"); } if (!Enum.TryParse<CharacterRace>(race, out cr)) { throw new Exception("Race invalid"); } if (!Enum.TryParse<CharacterClass>(characterclass, out cc)) { throw new Exception("Class invalid"); } Character newCharacter = new Character(name, cf, cr, cc); newCharacter.Id = id; newCharacter.Level = level; newCharacter.Active = Active; PlayerData p = new PlayerData(FileName); p.EditCharacter(UserName, newCharacter); }
public List<Character> GetCharacter() { PlayerData p = new PlayerData(FileName); return p.GetCharacter(UserName); }
public Character GetCharacter(Guid id) { PlayerData p = new PlayerData(FileName); return p.GetCharacter(UserName, id); }
public List<Player> GetPlayer() { PlayerData p = new PlayerData(FileName); return p.GetPlayer(); }
public Player GetPlayer(string userName) { PlayerData p = new PlayerData(FileName); return p.GetPlayer(userName); }
public Player GetPlayer(string userName, string password) { PlayerData p = new PlayerData(FileName); return p.GetPlayer(userName, password); }
public void EditPlayer(string userName, bool isAdmin) { PlayerData p = new PlayerData(FileName); p.EditPlayer(userName, isAdmin); }
public void AddPlayer(string userName, string password) { PlayerData p = new PlayerData(FileName); p.AddPlayer(userName, password); }