Package mekhq
Class CampaignPreset
java.lang.Object
mekhq.CampaignPreset
This is an object which holds a set of objects that collectively define the initial options setup for a campaign.
It includes both startup values, which are only used on initial startup (the date, starting planet, and rank system), and continuous options, which can be applied at any time (campaign options, skills, SPAs).
It also includes a short title and description that allows one to create and save different presets. The goal is to allow users to create and load various different presets.
-
Constructor Summary
ConstructorsConstructorDescriptionCampaignPreset(boolean userData) CampaignPreset(String title, String description, boolean userData, LocalDate date, Faction faction, Planet planet, RankSystem rankSystem, int contractCount, boolean gm, CompanyGenerationOptions companyGenerationOptions, megamek.common.options.GameOptions gameOptions, CampaignOptions campaignOptions, RandomSkillPreferences randomSkillPreferences, Map<String, SkillType> skills, Map<String, SpecialAbility> specialAbilities) -
Method Summary
Modifier and TypeMethodDescriptionstatic List<CampaignPreset>Retrieves a combined list of all campaign presets from the default directory, the old user data directory, and the modern (user-defined) user data directory.intgetDate()megamek.common.options.GameOptionsgetTitle()booleanisGM()booleanstatic List<CampaignPreset>loadCampaignPresetsFromDirectory(File directory) static CampaignPresetparseFromFile(File file) static CampaignPresetparseFromXML(NodeList nl, megamek.Version version) voidsetCampaignOptions(CampaignOptions campaignOptions) voidsetCompanyGenerationOptions(CompanyGenerationOptions companyGenerationOptions) voidsetContractCount(int contractCount) voidvoidsetDescription(String description) voidsetFaction(Faction faction) voidsetGameOptions(megamek.common.options.GameOptions gameOptions) voidsetGM(boolean gm) voidvoidsetRandomSkillPreferences(RandomSkillPreferences randomSkillPreferences) voidsetRankSystem(RankSystem rankSystem) voidvoidsetSpecialAbilities(Map<String, SpecialAbility> specialAbilities) voidtoString()voidwriteToFile(JFrame frame, File file) voidwriteToXML(PrintWriter pw, int indent)
-
Constructor Details
-
CampaignPreset
public CampaignPreset() -
CampaignPreset
public CampaignPreset(boolean userData) -
CampaignPreset
public CampaignPreset(String title, String description, boolean userData, @Nullable LocalDate date, @Nullable Faction faction, @Nullable Planet planet, @Nullable RankSystem rankSystem, int contractCount, boolean gm, @Nullable CompanyGenerationOptions companyGenerationOptions, @Nullable megamek.common.options.GameOptions gameOptions, @Nullable CampaignOptions campaignOptions, @Nullable RandomSkillPreferences randomSkillPreferences, Map<String, SkillType> skills, Map<String, SpecialAbility> specialAbilities)
-
-
Method Details
-
isUserData
public boolean isUserData() -
getTitle
- Returns:
- the title of the
CampaignPreset
-
setTitle
-
getDescription
-
setDescription
-
getDate
-
setDate
-
getFaction
-
setFaction
-
getPlanet
-
setPlanet
-
getRankSystem
-
setRankSystem
-
getContractCount
public int getContractCount() -
setContractCount
public void setContractCount(int contractCount) -
isGM
public boolean isGM() -
setGM
public void setGM(boolean gm) -
getCompanyGenerationOptions
-
setCompanyGenerationOptions
public void setCompanyGenerationOptions(@Nullable CompanyGenerationOptions companyGenerationOptions) -
getGameOptions
@Nullable public megamek.common.options.GameOptions getGameOptions() -
setGameOptions
public void setGameOptions(@Nullable megamek.common.options.GameOptions gameOptions) -
getCampaignOptions
-
setCampaignOptions
-
getRandomSkillPreferences
-
setRandomSkillPreferences
-
getSkills
-
setSkills
-
getSpecialAbilities
-
setSpecialAbilities
-
getCampaignPresets
Retrieves a combined list of all campaign presets from the default directory, the old user data directory, and the modern (user-defined) user data directory. The campaign presets are sourced, merged, and sorted in natural order before being returned.The method performs the following steps:
- Loads campaign presets from the default campaign presets directory.
- Loads campaign presets from the old user-specific campaign presets directory.
- Loads campaign presets from the modern user-specific campaign presets directory, typically defined by the user's current preferences.
- Combines all presets into a single list.
- Sorts the combined list of campaign presets in natural order.
- Returns:
- a
Listof all combined and sorted campaign presets found in the default and user data folders.
-
writeToFile
-
writeToXML
-
loadCampaignPresetsFromDirectory
-
parseFromFile
-
parseFromXML
-
toString
-