Class FameAndInfamyController

java.lang.Object
mekhq.campaign.universe.fameAndInfamy.FameAndInfamyController

public class FameAndInfamyController extends Object
  • Constructor Details

    • FameAndInfamyController

      public FameAndInfamyController()
      Constructor for the FameAndInfamyController class. Initializes the trackingFactions map with the provided map of factions. If any factions are missing from the provided map, they will be added with a default fame value of 3.0 (or 0.0 if the provided faction uses Batchalls).
  • Method Details

    • getAllFactionShortnames

      public List<String> getAllFactionShortnames()
      Retrieves the shortnames of all factions from the XML file.
      Returns:
      A list of faction shortnames.
    • getFameForFaction

      public double getFameForFaction(String factionCode)
      Retrieves the precise fame value for a given faction. Normally we don't care what the exact value is, so getFameLevelForFaction should be used, instead.
      Parameters:
      factionCode - the code of the faction
      Returns:
      the fame value for the faction
    • getFameLevelForFaction

      public int getFameLevelForFaction(String factionCode)
      Retrieves the fame level for a faction. This is determined by normally rounding raw fame to the nearest Integer
      Parameters:
      factionCode - The code of the faction.
      Returns:
      The fame level of the faction.
    • getFameName

      public String getFameName(String factionCode, boolean isInfamy)
      Retrieves the name of the fame level for a faction.
      Parameters:
      factionCode - The code of the faction.
      isInfamy - Specifies whether to retrieve the fame name for infamy or fame.
      Returns:
      The name of the fame level for the faction.
    • setFameForFaction

      public void setFameForFaction(String factionCode, double fame)
      Sets the fame value for a specific faction.
      Parameters:
      factionCode - The code representing the faction.
      fame - The fame value to be set for the faction.
    • updateFameForFaction

      public void updateFameForFaction(Campaign campaign, String factionCode, double adjustment)
      Updates the fame of a faction by a specified adjustment.
      Parameters:
      factionCode - The code representing the faction.
      campaign - The current campaign.
      adjustment - The adjustment to be made to the faction's fame.
    • writeToXml

      public void writeToXml(PrintWriter printWriter, int indent)
      Writes the fame and infamy data to an XML file using the provided PrintWriter and indent level.
      Parameters:
      printWriter - The PrintWriter used to write to the XML file.
      indent - The indent level for formatting the XML file.
    • parseFromXML

      public static void parseFromXML(NodeList nodeList, Campaign campaign)
      Parses the XML NodeList and updates the fame values for factions in a Campaign.
      Parameters:
      nodeList - The XML NodeList containing the faction fame values.
      campaign - The Campaign object to update with the parsed fame values.