Class FameAndInfamyController
java.lang.Object
mekhq.campaign.universe.fameAndInfamy.FameAndInfamyController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the shortnames of all factions from the XML file.double
getFameForFaction
(String factionCode) Retrieves the precise fame value for a given faction.int
getFameLevelForFaction
(String factionCode) Retrieves the fame level for a faction.getFameName
(String factionCode, boolean isInfamy) Retrieves the name of the fame level for a faction.static void
parseFromXML
(NodeList nodeList, Campaign campaign) void
setFameForFaction
(String factionCode, double fame) Sets the fame value for a specific faction.void
updateFameForFaction
(Campaign campaign, String factionCode, double adjustment) Updates the fame of a faction by a specified adjustment.void
writeToXml
(PrintWriter printWriter, int indent) Writes the fame and infamy data to an XML file using the providedPrintWriter
and indent level.
-
Constructor Details
-
FameAndInfamyController
public FameAndInfamyController()Constructor for theFameAndInfamyController
class. Initializes thetrackingFactions
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
Retrieves the shortnames of all factions from the XML file.- Returns:
- A list of faction shortnames.
-
getFameForFaction
Retrieves the precise fame value for a given faction. Normally we don't care what the exact value is, sogetFameLevelForFaction
should be used, instead.- Parameters:
factionCode
- the code of the faction- Returns:
- the fame value for the faction
-
getFameLevelForFaction
Retrieves the fame level for a faction. This is determined by normally rounding raw fame to the nearestInteger
- Parameters:
factionCode
- The code of the faction.- Returns:
- The fame level of the faction.
-
getFameName
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
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
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
Writes the fame and infamy data to an XML file using the providedPrintWriter
and indent level.- Parameters:
printWriter
- ThePrintWriter
used to write to the XML file.indent
- The indent level for formatting the XML file.
-
parseFromXML
-