Package mekhq.campaign.market.unitMarket
Class AbstractUnitMarket
java.lang.Object
mekhq.campaign.market.unitMarket.AbstractUnitMarket
- Direct Known Subclasses:
AtBMonthlyUnitMarket,DisabledUnitMarket
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddOffers(Campaign campaign, int number, UnitMarketType market, int unitType, Faction faction, int quality, int priceTarget) This adds a number of unit offersaddSingleUnit(Campaign campaign, UnitMarketType market, int unitType, megamek.common.loaders.MekSummary mekSummary, int percent) addSingleUnit(Campaign campaign, UnitMarketType market, int unitType, Faction faction, int quality, int percent) protected StringaddSingleUnit(Campaign campaign, UnitMarketType market, int unitType, Faction faction, int weight, int quality, Collection<megamek.common.units.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, int percent) addSingleUnit(Campaign campaign, UnitMarketType market, int unitType, Faction faction, int quality, Collection<megamek.common.units.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, int percent) voidfillFromXML(Node wn, Campaign campaign, megamek.Version version) This method fills the market based on the supplied XML node.protected intgenerateTransitDuration(Campaign campaign) abstract voidgenerateUnitOffers(Campaign campaign) This is the primary Unit Market generation method, which is how the market specified generates unit offersprotected abstract intgenerateWeight(Campaign campaign, int unitType, Faction faction) protected voidparseXMLNode(Node wn, Campaign campaign, megamek.Version version) This is meant to be overridden so that a market can have additional elements added to it, albeit with this called by super.parseXMLNode(wn) first.abstract voidprocessNewDay(Campaign campaign) This is the primary method for processing the Unit Market.protected abstract voidremoveUnitOffers(Campaign campaign) This is the primary Unit Market removal method, which is how the market specified removes unit offersvoidsetOffers(List<UnitMarketOffer> offers) protected voidwriteBodyToXML(PrintWriter pw, int indent) This is meant to be overridden so that a market can have additional elements added to it, albeit with this called by super.writeBodyToXML(pw, indent) first.protected voidwriteRefreshReport(Campaign campaign) voidwriteToXML(PrintWriter pw, int indent) This writes the Unit Market to XML
-
Field Details
-
resources
-
-
Constructor Details
-
AbstractUnitMarket
-
-
Method Details
-
getMethod
-
getOffers
-
setOffers
-
processNewDay
This is the primary method for processing the Unit Market. It is executed as part ofCampaign.newDay()- Parameters:
campaign- the campaign to process the Unit Market new day using
-
generateUnitOffers
This is the primary Unit Market generation method, which is how the market specified generates unit offers- Parameters:
campaign- the campaign to generate the unit offers for
-
addOffers
public abstract void addOffers(Campaign campaign, int number, UnitMarketType market, int unitType, @Nullable Faction faction, int quality, int priceTarget) This adds a number of unit offers- Parameters:
campaign- the campaign to add the offers based onnumber- the number of units to generatemarket- the unit market type the unit is part ofunitType- the unit type to generatefaction- the faction to add the offers for, or null. If null, that must be handled within this method before any generated offers may be added to the market.quality- the quality of the unit to generatepriceTarget- the target number used to determine the percent
-
addSingleUnit
@Nullable public String addSingleUnit(Campaign campaign, UnitMarketType market, int unitType, Faction faction, int quality, int percent) - Parameters:
campaign- the campaign to use to generate the unitmarket- the market type the unit is being offered inunitType- the unit type to generate the unit withfaction- the faction to generate the unit fromquality- the quality to generate the unit atpercent- the percentage of the original unit cost the unit will be offered at- Returns:
- the name of the unit that has been added to the market, or null if none were added
-
addSingleUnit
@Nullable public String addSingleUnit(Campaign campaign, UnitMarketType market, int unitType, Faction faction, int quality, Collection<megamek.common.units.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, int percent) - Parameters:
campaign- the campaign to use to generate the unit offermarket- the market type the unit is being offered inunitType- the unit type to generate the unit withfaction- the faction to generate the unit fromquality- the quality to generate the unit atmovementModes- the movement modes to generate formissionRoles- the mission roles to generate forpercent- the percentage of the original unit cost the unit will be offered at- Returns:
- the name of the unit that has been added to the market, or null if none were added
-
addSingleUnit
@Nullable protected String addSingleUnit(Campaign campaign, UnitMarketType market, int unitType, Faction faction, int weight, int quality, Collection<megamek.common.units.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, int percent) - Parameters:
campaign- the campaign to use to generate the unit offermarket- the market type the unit is being offered inunitType- the unit type to generate the unit withfaction- the faction to generate the unit fromweight- the weight class to generate the unit atquality- the quality to generate the unit atmovementModes- the movement modes to generate formissionRoles- the mission roles to generate forpercent- the percentage of the original unit cost the unit will be offered at- Returns:
- the name of the unit that has been added to the market, or null if none were added
-
addSingleUnit
public String addSingleUnit(Campaign campaign, UnitMarketType market, int unitType, megamek.common.loaders.MekSummary mekSummary, int percent) - Parameters:
campaign- the campaign to use to generate the offermarket- the market type the unit is being offered inunitType- the unit type of the generated unitmekSummary- the generated mek summarypercent- the percentage of the original unit cost the unit will be offered at- Returns:
- the name of the unit that has been added to the market
-
generateWeight
- Parameters:
campaign- the campaign to generate the unit weight based onunitType- the unit type to determine the format of weight to generatefaction- the faction to generate the weight for- Returns:
- the generated weight
-
generateTransitDuration
- Parameters:
campaign- the campaign to use to generate the transit duration- Returns:
- the generated transit duration
-
writeRefreshReport
- Parameters:
campaign- the campaign to write the refresh report to
-
removeUnitOffers
This is the primary Unit Market removal method, which is how the market specified removes unit offers- Parameters:
campaign- the campaign to use in determining the offers to remove
-
writeToXML
This writes the Unit Market to XML- Parameters:
pw- the PrintWriter to write toindent- the base indent level to write at
-
writeBodyToXML
This is meant to be overridden so that a market can have additional elements added to it, albeit with this called by super.writeBodyToXML(pw, indent) first.- Parameters:
pw- the PrintWriter to write toindent- the base indent level to write at
-
fillFromXML
This method fills the market based on the supplied XML node. The market is initialized as empty before this is called.- Parameters:
wn- the node to fill the market fromcampaign- the campaign the market is being parsed as part ofversion- the version of the market being parsed
-
parseXMLNode
This is meant to be overridden so that a market can have additional elements added to it, albeit with this called by super.parseXMLNode(wn) first.- Parameters:
wn- the node to parse from XMLcampaign- the campaign the market is being parsed as part ofversion- the version of the market being parsed
-