Package mekhq

Class CampaignPreset

java.lang.Object
mekhq.CampaignPreset

public class CampaignPreset extends Object
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 Details

  • Method Details

    • isUserData

      public boolean isUserData()
    • getTitle

      public String getTitle()
      Returns:
      the title of the CampaignPreset
    • setTitle

      public void setTitle(String title)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getDate

      @Nullable public LocalDate getDate()
    • setDate

      public void setDate(@Nullable LocalDate date)
    • getFaction

      @Nullable public Faction getFaction()
    • setFaction

      public void setFaction(@Nullable Faction faction)
    • getPlanet

      @Nullable public Planet getPlanet()
    • setPlanet

      public void setPlanet(@Nullable Planet planet)
    • getRankSystem

      @Nullable public RankSystem getRankSystem()
    • setRankSystem

      public void setRankSystem(@Nullable RankSystem rankSystem)
    • getContractCount

      public int getContractCount()
    • setContractCount

      public void setContractCount(int contractCount)
    • isGM

      public boolean isGM()
    • setGM

      public void setGM(boolean gm)
    • getCompanyGenerationOptions

      public CompanyGenerationOptions 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

      @Nullable public CampaignOptions getCampaignOptions()
    • setCampaignOptions

      public void setCampaignOptions(@Nullable CampaignOptions campaignOptions)
    • getRandomSkillPreferences

      @Nullable public RandomSkillPreferences getRandomSkillPreferences()
    • setRandomSkillPreferences

      public void setRandomSkillPreferences(@Nullable RandomSkillPreferences randomSkillPreferences)
    • getSkills

      public Map<String,SkillType> getSkills()
    • setSkills

      public void setSkills(Map<String,SkillType> skills)
    • getSpecialAbilities

      public Map<String,SpecialAbility> getSpecialAbilities()
    • setSpecialAbilities

      public void setSpecialAbilities(Map<String,SpecialAbility> specialAbilities)
    • getCampaignPresets

      public static List<CampaignPreset> 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 List of all combined and sorted campaign presets found in the default and user data folders.
    • writeToFile

      public void writeToFile(JFrame frame, @Nullable File file)
    • writeToXML

      public void writeToXML(PrintWriter pw, int indent)
    • loadCampaignPresetsFromDirectory

      public static List<CampaignPreset> loadCampaignPresetsFromDirectory(@Nullable File directory)
    • parseFromFile

      @Nullable public static CampaignPreset parseFromFile(@Nullable File file)
    • parseFromXML

      @Nullable public static CampaignPreset parseFromXML(NodeList nl, megamek.Version version)
    • toString

      public String toString()
      Overrides:
      toString in class Object