/// <summary> /// Update the set of recruits /// </summary> internal void CreateRecruits() { var recuritsToRemove = new List <string>(); //remove recruits from iat and randomly select to remove them from pool of available recruits foreach (var member in Recruits) { var path = Path.Combine(storageLocation, member.Value.RolePlayCharacter.VoiceName + ".rpc").Replace("\\", "/"); iat.RemoveCharacters(new List <int> { iat.GetAllCharacterSources().First(c => c.Source.Replace("\\", "/") == path).Id }); if (StaticRandom.Int(0, 100) % ConfigKey.RecruitChangeChance.GetIntValue() != 0) { recuritsToRemove.Add(member.Key); } } foreach (var member in recuritsToRemove) { Recruits.Remove(member); } //for the amount of empty recruit spaces, create a new recruit var amount = ConfigKey.RecruitCount.GetIntValue() - Recruits.Count; for (var i = 0; i < amount; i++) { var position = Boat.GetWeakestPosition(CrewMembers.Values.Concat(Recruits.Values).ToList()); var newMember = new CrewMember(position, Nationality); UniqueNameCheck(newMember); Recruits.Add(newMember.Name, newMember); } var storeNum = 0; //set up the files for each recruit and their avatar foreach (var recruit in Recruits) { recruit.Value.CreateRecruitFile(iat, storageLocation, storeNum); storeNum++; } iat.Save(); }
/// <summary> /// Add a recruit into crewMembers /// </summary> internal void AddRecruit(CrewMember member) { //remove recruit from the current list of characters in the game var path = Path.Combine(storageLocation, member.RolePlayCharacter.VoiceName + ".rpc").Replace("\\", "/"); iat.RemoveCharacters(new List <int> { iat.GetAllCharacterSources().First(c => c.Source.Replace("\\", "/") == path).Id }); //set up recruit as a 'proper' character in the game var currentNames = crewMembers.Keys.ToList(); currentNames.Add(ManagerName); member.CreateTeamMemberFile(iat, storageLocation, currentNames, TeamColorsPrimary, TeamColorsSecondary); foreach (var cm in crewMembers.Values) { cm.CreateInitialOpinions(new List <string> { member.Name }, true); } AddCrewMember(member); Recruits.Remove(member.Name); iat.Save(); }