public static Employee GenerateNew(byte minLevel, byte maxLevel, EmployeeInfo.Skill speciality = EmployeeInfo.Skill.Nothing, bool noSkills = false, Random random = null) { var rand = random ?? new Random(); var firstName = Utils.GetRandomString(EmployeeInfo.FirstNames, rand); var lastName = Utils.GetRandomString(EmployeeInfo.LastNames, rand); var level = (byte) rand.Next(minLevel, maxLevel + 1); var wage = rand.Next((int)(MinimumWage * level * 0.75f), (int)(MinimumWage * level * 1.5f)); var skills = new Dictionary<EmployeeInfo.Skill, byte>(); var spec = speciality; if (speciality == EmployeeInfo.Skill.Nothing && noSkills == false) { spec = Utils.GetRandomEnum<EmployeeInfo.Skill>(rand); } foreach (EmployeeInfo.Skill skill in Enum.GetValues(typeof(EmployeeInfo.Skill))) { byte skillLevel; if(skill == spec) { skillLevel = (byte)rand.Next(level * 5, level * 10 + 1); if (skillLevel > 90) wage=(int)(wage * 1.25f); } else { skillLevel = (byte)rand.Next(level, level * 5 + 1); } skills.Add(skill, skillLevel); } return new Employee(firstName, lastName, level, wage, skills, spec); }
public Dictionary<EmployeeInfo.Skill, byte> Skills; // skill levels go from 1 to 100 public Employee(string firstName, string lastName, byte level, int wage, Dictionary<EmployeeInfo.Skill, byte> skills, EmployeeInfo.Skill speciality) { FirstName = firstName; LastName = lastName; Level = level; Wage = wage; Skills = skills; Speciality = speciality; UniqueId = firstName.GetHashCode() + lastName.GetHashCode() + level.GetHashCode() + wage.GetHashCode(); }