Class TrainingPresets
java.lang.Object
mekhq.campaign.personnel.training.TrainingPresets
A campaign's saved auto-train presets, and running the ones marked to run at the start of each month.
- Since:
- 0.51.01
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TrainingPresetsgenerateInstanceFromXML(Node node, CampaignOptions campaignOptions) Reads presets from a<trainingPresets>element; an unreadable preset is logged and skipped.booleanvoidrunMonthly(Campaign campaign) Runs every preset marked to run monthly, in order, on the campaign's active personnel.voidsave(AutoTrainSettings preset) Saves a preset, replacing any with the same name.voidwriteToXML(PrintWriter writer, int indent) Writes the presets as a<trainingPresets>element, or nothing if there are none.
-
Constructor Details
-
TrainingPresets
public TrainingPresets()
-
-
Method Details
-
getPresets
- Returns:
- the presets, in the order the player saved them
-
find
- Parameters:
name- a preset's name- Returns:
- the preset with that name, ignoring case, or
null
-
save
Saves a preset, replacing any with the same name.- Parameters:
preset- the preset
-
remove
- Parameters:
name- a preset's name- Returns:
trueif a preset with that name was removed
-
runMonthly
Runs every preset marked to run monthly, in order, on the campaign's active personnel. A preset whose training fees the campaign can't pay is skipped, with a note in the daily report.- Parameters:
campaign- the campaign
-
writeToXML
Writes the presets as a<trainingPresets>element, or nothing if there are none.- Parameters:
writer- the writerindent- the indent
-
generateInstanceFromXML
Reads presets from a<trainingPresets>element; an unreadable preset is logged and skipped.- Parameters:
node- the elementcampaignOptions- the campaign's options, for the defaults of missing values- Returns:
- the presets
-