Class NewPersonnelMarket
java.lang.Object
mekhq.campaign.market.personnelMarket.markets.NewPersonnelMarket
- Direct Known Subclasses:
PersonnelMarketCamOpsRevised,PersonnelMarketMekHQ
Represents the Personnel Market system for managing the recruitment, listing, and data persistence of potential
recruits within a campaign.
Handles the generation, filtration, and display of available applicants, as well as reading and writing applicant data from/to XML. Integrates campaign state, planetary context, reputation effects, market style, and market-specific applicant pools for a flexible personnel recruitment experience.
- Since:
- 0.50.06
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Personnel Market instance bound to a campaign. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddApplicant(Person applicant) Adds a new applicant to the current applicant pool.voidaddRarePerson(UUID personId) Adds aUUIDto the set of rare personnel, if notnull.voidaddRareProfession(PersonnelRole rareProfession) Adds a profession to the list of rare professions.voidClears all current applicants from the market.voidGathers new applicant data and updates the internal applicant list based on current campaign state and settings.voidGenerates new applicants and adds them to the market's applicant pool.static NewPersonnelMarketgeneratePersonnelMarketDataFromXML(Campaign campaign, Node parentNode, megamek.Version version) Generates Personnel Market data by loading it from an XML document node.Returns the factions from which applicants may originate.Gets the associated personnel market style used by this market.Gets an availability message describing the market's state or conditions.Returns the campaign associated with this Personnel Market.Returns the faction associated with the campaign for recruitment filtering.Returns the map of available clan market entries and their role distributions.Returns the current list of market applicants.Returns the planetary system currently used for market context.intReturns the campaign year for market behavior.booleanReturns whether rare personnel are available on the market.getHiringCost(Person applicant) getHiringCostBreakdown(Person applicant) Gets the cost of hiring an applicant, split by part, so the hiring hall can show how it is made up.Returns the map of available Inner Sphere market entries and their role distributions.intReturns the index or filter value last used for applicant selection.static intGets the recruitment divider value for low population systems.getMarketEntriesAsList(Map<PersonnelRole, PersonnelMarketEntry> marketEntries) Returns a list ofPersonnelMarketEntryobjects sorted alphabetically by the string value of each entry's profession.Returns the set of rare personnel.Returns a list of rare professions currently stored.intReturns the number of recruitment rolls performed for the current market evaluation.Retrieves a single applicant if available.getToday()Returns the in-game date currently used for market evaluation.static intGets the unit reputation cutoff value for recruitment.booleanReturns whether a golden hello (recruitment incentive) is being offered.booleanReturns whether a golden hello (recruitment incentive) was being offered when applicants were generated.sanitizeMarketEntries(Map<PersonnelRole, PersonnelMarketEntry> marketEntries) Removes entries with non-positive weights or counts from the supplied personnel market entries map.voidsetApplicantOriginFactions(List<Faction> applicantOriginFactions) Sets the list of origin factions for new applicants.voidsetAssociatedPersonnelMarketStyle(PersonnelMarketStyle associatedPersonnelMarketStyle) Sets the market style for the personnel market.voidsetCampaign(Campaign campaign) voidsetCampaignFaction(Faction campaignFaction) Sets the campaign's faction, influencing applicant origins.voidsetClanMarketEntries(Map<PersonnelRole, PersonnelMarketEntry> clanMarketEntries) Sets the clan market entries data.voidsetCurrentApplicants(List<Person> currentApplicants) Sets the list of current market applicants.voidsetCurrentSystem(PlanetarySystem currentSystem) Sets the planetary system for the current personnel market.voidsetGameYear(int gameYear) Sets the current game year for the personnel market.voidsetHasRarePersonnel(boolean hasRarePersonnel) Deprecated, for removal: This API element is subject to removal in a future version.voidsetInnerSphereMarketEntries(Map<PersonnelRole, PersonnelMarketEntry> innerSphereMarketEntries) Sets the Inner Sphere market entries data.voidsetLastSelectedFilter(int lastSelectedFilter) Sets the last-used selection filter value.static voidsetLowPopulationRecruitmentDivider(int divider) Sets the recruitment divider for low population systems.voidsetOfferingGoldenHello(boolean offeringGoldenHello) Sets whether a golden hello (recruitment incentive) is being offered.voidsetRecruitmentRolls(int recruitmentRolls) Sets the number of recruitment rolls for the market.voidSets the in-game date used to determine market status.static voidsetUnitReputationRecruitmentCutoff(int cutoff) Sets the cutoff value for unit reputation in recruitment eligibility.voidsetWasOfferingGoldenHello(boolean wasOfferingGoldenHello) Sets whether a golden hello (recruitment incentive) was being offered when applicants were generated.voidLaunches the user interface dialog displaying the current personnel market.voidwritePersonnelMarketDataToXML(PrintWriter writer, int indent) Serializes the Personnel Market data to XML output.
-
Constructor Details
-
NewPersonnelMarket
public NewPersonnelMarket()Creates a new Personnel Market instance bound to a campaign.- Since:
- 0.50.06
-
-
Method Details
-
generatePersonnelMarketDataFromXML
public static NewPersonnelMarket generatePersonnelMarketDataFromXML(Campaign campaign, Node parentNode, megamek.Version version) Generates Personnel Market data by loading it from an XML document node.- Parameters:
campaign- The relevant campaign saveparentNode- XML node parent containing market dataversion- Version the save was last made in- Returns:
- Loaded Personnel Market instance
- Since:
- 0.50.06
-
gatherApplications
public void gatherApplications()Gathers new applicant data and updates the internal applicant list based on current campaign state and settings.- Since:
- 0.50.06
-
generateApplicants
public void generateApplicants()Generates new applicants and adds them to the market's applicant pool.- Since:
- 0.50.06
-
getSingleApplicant
Retrieves a single applicant if available.- Returns:
- a
Person, ornullif no applicant exists
-
showPersonnelMarketDialog
public void showPersonnelMarketDialog()Launches the user interface dialog displaying the current personnel market.- Since:
- 0.50.06
-
writePersonnelMarketDataToXML
Serializes the Personnel Market data to XML output.- Parameters:
writer- Output PrintWriterindent- XML indentation level- Since:
- 0.50.06
-
getAssociatedPersonnelMarketStyle
Gets the associated personnel market style used by this market.- Returns:
- the personnel market style
- Since:
- 0.50.06
-
setAssociatedPersonnelMarketStyle
Sets the market style for the personnel market.- Parameters:
associatedPersonnelMarketStyle- the personnel market style to use- Since:
- 0.50.06
-
getLowPopulationRecruitmentDivider
public static int getLowPopulationRecruitmentDivider()Gets the recruitment divider value for low population systems.- Returns:
- recruitment divider integer
- Since:
- 0.50.06
-
setLowPopulationRecruitmentDivider
public static void setLowPopulationRecruitmentDivider(int divider) Sets the recruitment divider for low population systems.- Parameters:
divider- recruitment divider to set- Since:
- 0.50.06
-
getUnitReputationRecruitmentCutoff
public static int getUnitReputationRecruitmentCutoff()Gets the unit reputation cutoff value for recruitment.- Returns:
- reputation cutoff threshold
- Since:
- 0.50.06
-
setUnitReputationRecruitmentCutoff
public static void setUnitReputationRecruitmentCutoff(int cutoff) Sets the cutoff value for unit reputation in recruitment eligibility.- Parameters:
cutoff- reputation cutoff to set- Since:
- 0.50.06
-
getClanMarketEntries
Returns the map of available clan market entries and their role distributions.- Returns:
- map of personnel roles to market entries (Clan)
- Since:
- 0.50.06
-
setClanMarketEntries
Sets the clan market entries data.- Parameters:
clanMarketEntries- map of personnel roles to market entries- Since:
- 0.50.06
-
getInnerSphereMarketEntries
Returns the map of available Inner Sphere market entries and their role distributions.- Returns:
- map of personnel roles to market entries (Inner Sphere)
- Since:
- 0.50.06
-
setInnerSphereMarketEntries
public void setInnerSphereMarketEntries(Map<PersonnelRole, PersonnelMarketEntry> innerSphereMarketEntries) Sets the Inner Sphere market entries data.- Parameters:
innerSphereMarketEntries- map of personnel roles to market entries- Since:
- 0.50.06
-
getCampaign
Returns the campaign associated with this Personnel Market.- Returns:
- campaign instance
- Since:
- 0.50.06
-
setCampaign
- Parameters:
campaign- Campaign instance that this instance will be attached to and access
-
getCampaignFaction
Returns the faction associated with the campaign for recruitment filtering.- Returns:
- campaign's faction
- Since:
- 0.50.06
-
setCampaignFaction
Sets the campaign's faction, influencing applicant origins.- Parameters:
campaignFaction- the new campaign faction- Since:
- 0.50.06
-
getToday
Returns the in-game date currently used for market evaluation.- Returns:
- current date
- Since:
- 0.50.06
-
setToday
Sets the in-game date used to determine market status.- Parameters:
today- new current date- Since:
- 0.50.06
-
getGameYear
public int getGameYear()Returns the campaign year for market behavior.- Returns:
- game year
- Since:
- 0.50.06
-
setGameYear
public void setGameYear(int gameYear) Sets the current game year for the personnel market.- Parameters:
gameYear- the game year to set- Since:
- 0.50.06
-
getApplicantOriginFactions
Returns the factions from which applicants may originate.- Returns:
- list of applicant origin factions
- Since:
- 0.50.06
-
setApplicantOriginFactions
Sets the list of origin factions for new applicants.- Parameters:
applicantOriginFactions- list to set- Since:
- 0.50.06
-
getCurrentApplicants
Returns the current list of market applicants.- Returns:
- list of applicants
- Since:
- 0.50.06
-
getLastSelectedFilter
public int getLastSelectedFilter()Returns the index or filter value last used for applicant selection.- Returns:
- filter index
- Since:
- 0.50.06
-
setLastSelectedFilter
public void setLastSelectedFilter(int lastSelectedFilter) Sets the last-used selection filter value.- Parameters:
lastSelectedFilter- filter index- Since:
- 0.50.06
-
addApplicant
Adds a new applicant to the current applicant pool.- Parameters:
applicant- the new Personnel applicant- Since:
- 0.50.06
-
clearCurrentApplicants
public void clearCurrentApplicants()Clears all current applicants from the market.- Since:
- 0.50.06
-
setCurrentApplicants
Sets the list of current market applicants.- Parameters:
currentApplicants- list of applicants to set- Since:
- 0.50.06
-
isOfferingGoldenHello
public boolean isOfferingGoldenHello()Returns whether a golden hello (recruitment incentive) is being offered.- Returns:
trueif a golden hello is offered, otherwisefalse- Since:
- 0.50.06
-
setOfferingGoldenHello
public void setOfferingGoldenHello(boolean offeringGoldenHello) Sets whether a golden hello (recruitment incentive) is being offered.- Parameters:
offeringGoldenHello-trueto offer,falseotherwise- Since:
- 0.50.06
-
isWasOfferingGoldenHello
public boolean isWasOfferingGoldenHello()Returns whether a golden hello (recruitment incentive) was being offered when applicants were generated.- Returns:
trueif a golden hello was offered,falseotherwise- Since:
- 0.50.06
-
setWasOfferingGoldenHello
public void setWasOfferingGoldenHello(boolean wasOfferingGoldenHello) Sets whether a golden hello (recruitment incentive) was being offered when applicants were generated.- Parameters:
wasOfferingGoldenHello-trueif a golden hello was offered,falseotherwise- Since:
- 0.50.07
-
getHasRarePersonnel
public boolean getHasRarePersonnel()Returns whether rare personnel are available on the market.- Returns:
trueif rare personnel are present, otherwisefalse- Since:
- 0.50.06
-
setHasRarePersonnel
@Deprecated(since="0.50.07", forRemoval=true) public void setHasRarePersonnel(boolean hasRarePersonnel) Deprecated, for removal: This API element is subject to removal in a future version.Sets the status of rare personnel availability.- Parameters:
hasRarePersonnel-trueif present,falseotherwise- Since:
- 0.50.06
-
getRarePersonnel
Returns the set of rare personnel. -
addRarePerson
Adds aUUIDto the set of rare personnel, if notnull.- Parameters:
personId- theUUIDto add to the rare personnel set; ignored ifnull- Since:
- 0.50.07
-
getRareProfessions
Returns a list of rare professions currently stored.- Returns:
- a list of
PersonnelRolerepresenting rare professions - Since:
- 0.50.06
-
addRareProfession
Adds a profession to the list of rare professions.- Parameters:
rareProfession- thePersonnelRoleto mark as rare and add to the list- Since:
- 0.50.06
-
getRecruitmentRolls
public int getRecruitmentRolls()Returns the number of recruitment rolls performed for the current market evaluation.- Returns:
- recruitment rolls value
- Since:
- 0.50.06
-
setRecruitmentRolls
public void setRecruitmentRolls(int recruitmentRolls) Sets the number of recruitment rolls for the market.- Parameters:
recruitmentRolls- number of rolls to set- Since:
- 0.50.06
-
getCurrentSystem
Returns the planetary system currently used for market context.- Returns:
- planetary system
- Since:
- 0.50.06
-
setCurrentSystem
Sets the planetary system for the current personnel market.- Parameters:
currentSystem- planetary system to set- Since:
- 0.50.06
-
getAvailabilityMessage
Gets an availability message describing the market's state or conditions.- Returns:
- market availability message
- Since:
- 0.50.06
-
sanitizeMarketEntries
public Map<PersonnelRole,PersonnelMarketEntry> sanitizeMarketEntries(Map<PersonnelRole, PersonnelMarketEntry> marketEntries) Removes entries with non-positive weights or counts from the supplied personnel market entries map.Iterates over the existing map and removes any
PersonnelMarketEntrywhoseweight()orcount()is less than or equal to zero.- Parameters:
marketEntries- the map of personnel roles to market entries to sanitize; modified in place- Returns:
- the sanitized map, containing only entries with positive weights
- Since:
- 0.50.06
-
getMarketEntriesAsList
public List<PersonnelMarketEntry> getMarketEntriesAsList(Map<PersonnelRole, PersonnelMarketEntry> marketEntries) Returns a list ofPersonnelMarketEntryobjects sorted alphabetically by the string value of each entry's profession. This ensures a deterministic order for processing or testing, regardless of the original iteration order of the provided map.- Parameters:
marketEntries- a map containing personnel roles as keys and their corresponding market entries as values- Returns:
- a list of market entries sorted alphabetically by profession
- Since:
- 0.50.06
-
getHiringCost
-
getHiringCostBreakdown
Gets the cost of hiring an applicant, split by part, so the hiring hall can show how it is made up.- Parameters:
applicant- the applicant- Returns:
- the hiring cost, by part; its total matches
getHiringCost(Person) - Since:
- 0.51.01
-