2 using System.Collections.Generic;
10 public List<CharacterInfo>
PendingHires =
new List<CharacterInfo>();
24 public static int GetSalaryFor(IReadOnlyCollection<CharacterInfo> hires)
33 foreach (var character
in crew)
35 multiplier += character?.Info?.GetSavedStatValueWithAll(
StatTypes.HireCostMultiplier, hire.Job.Prefab.Identifier) ?? 0;
37 float finalMultiplier = 1f + MathF.Max(multiplier, -1f);
38 return (
int)(hire.Salary * finalMultiplier);
46 foreach (var missingJob
in location.Type.GetHireablesMissingFromCrew())
48 AddCharacter(missingJob);
51 for (
int i = 0; i < amount; i++)
53 AddCharacter(location.Type.GetRandomHireable());
55 if (location.Faction !=
null) { GenerateFactionCharacters(location.Faction.Prefab); }
56 if (location.SecondaryFaction !=
null) { GenerateFactionCharacters(location.SecondaryFaction.Prefab); }
60 if (job ==
null) {
return; }
61 int variant = Rand.Range(0, job.
Variants, Rand.RandSync.ServerAndClient);
66 private void GenerateFactionCharacters(FactionPrefab faction)
68 foreach (var character
in faction.HireableCharacters)
70 HumanPrefab humanPrefab = NPCSet.Get(character.NPCSetIdentifier, character.NPCIdentifier);
71 if (humanPrefab ==
null)
73 DebugConsole.ThrowError($
"Couldn't create a hireable for the location: character prefab \"{character.NPCIdentifier}\" not found in the NPC set \"{character.NPCSetIdentifier}\".");
77 characterInfo.MinReputationToHire = (faction.Identifier, character.MinReputation);
90 if (characterInfo ==
null ||
string.IsNullOrEmpty(newName)) {
return; }
92 PendingHires.FirstOrDefault(ci => ci == characterInfo)?.Rename(newName);
Stores information about the Character that is needed between rounds in the menu etc....
static readonly Identifier HumanSpeciesName
static ImmutableHashSet< Character > GetSessionCrewCharacters(CharacterType type)
Returns a list of crew characters currently in the game with a given filter.
void RemoveCharacter(CharacterInfo character)
static int GetSalaryFor(CharacterInfo hire)
void GenerateCharacters(Location location, int amount)
static int GetSalaryFor(IReadOnlyCollection< CharacterInfo > hires)
const int MaxAvailableCharacters
List< CharacterInfo > PendingHires
void RenameCharacter(CharacterInfo characterInfo, string newName)
List< CharacterInfo > AvailableCharacters
CharacterInfo CreateCharacterInfo(Rand.RandSync randSync=Rand.RandSync.Unsynced)
Creates a character info from the human prefab. If there are custom character infos defined,...
StatTypes
StatTypes are used to alter several traits of a character. They are mostly used by talents.