Package mekhq.campaign.mission
Class Contract
java.lang.Object
mekhq.campaign.mission.Mission
mekhq.campaign.mission.Contract
- Direct Known Subclasses:
AtBContract
Contracts - we need to track static amounts here because changes in the
underlying campaign don't change the figures once the ink is dry
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptContract
(Campaign campaign) Calculations to be performed once the contract has been accepted.void
void
void
calculateContract
(Campaign campaign) Only do this at the time the contract is set up, otherwise amounts may change after the ink is signed, which is a no-no.boolean
int
int
Get the estimated total profit for this contract.Gets the currently calculated jump path for this contract, only recalculating if it's not valid any longer or hasn't been calculated yet.int
Returns the contract length in months.int
int
getMonthsLeft
(LocalDate date) Get the number of months left in this contract after the given date.int
double
int
static String
getOverheadCompName
(int i) int
int
Retrieves the percentage of shares for this contract.int
int
int
int
getTravelDays
(Campaign campaign) Calculates the number of days required for travel based on the current campaign state.boolean
isActiveOn
(LocalDate date, boolean excludeEndDateCheck) boolean
void
loadFieldsFromXmlNode
(Campaign campaign, megamek.Version version, Node wn) boolean
protected void
setAdvanceAmount
(Money amount) void
setAdvancePct
(int s) void
setBaseAmount
(Money amount) void
setBattleLossComp
(int s) void
setCachedJumpPath
(JumpPath cachedJumpPath) void
setCommandRights
(ContractCommandRights commandRights) void
void
setEndDate
(LocalDate endDate) protected void
setFeeAmount
(Money amount) void
setLength
(int m) void
setMRBCFee
(boolean b) void
setMultiplier
(double s) protected void
setOverheadAmount
(Money amount) void
setOverheadComp
(int s) void
void
void
setSalvageExchange
(boolean b) void
setSalvagePct
(int s) protected void
setSigningBonusAmount
(Money amount) void
setSigningBonusPct
(int s) void
setStartAndEndDate
(LocalDate startDate) This sets the Start Date and End Date of the Contract based on the length of the contract and the starting date providedvoid
void
setStraightSupport
(int s) protected void
setSupportAmount
(Money amount) void
void
setTransitAmount
(Money amount) protected void
setTransportAmount
(Money amount) void
setTransportComp
(int s) void
subtractSalvageByUnit
(Money money) protected int
writeToXMLBegin
(Campaign campaign, PrintWriter pw, int indent) Methods inherited from class mekhq.campaign.mission.Mission
addScenario, clearScenarios, generateInstanceFromXML, getCompletedScenarios, getCurrentAtBScenarios, getCurrentScenarios, getDescription, getHyperlinkedName, getId, getName, getScenarios, getStatus, getSystem, getSystemId, getSystemName, getType, getVisibleScenarios, hasPendingScenarios, isActiveOn, loadFieldsFromXmlNode, setDesc, setId, setLegacyPlanetName, setName, setStatus, setType, toString, writeToXML, writeToXML, writeToXMLBegin, writeToXMLEnd
-
Field Details
-
OH_NONE
public static final int OH_NONE- See Also:
-
OH_HALF
public static final int OH_HALF- See Also:
-
OH_FULL
public static final int OH_FULL- See Also:
-
OH_NUM
public static final int OH_NUM- See Also:
-
MRBC_FEE_PERCENTAGE
public static final int MRBC_FEE_PERCENTAGE- See Also:
-
-
Constructor Details
-
Contract
public Contract() -
Contract
-
-
Method Details
-
getOverheadCompName
-
getEmployer
-
setEmployer
-
getLength
public int getLength()Returns the contract length in months.- Returns:
- the number and corresponding length of the contact in months as an integer
-
setLength
public void setLength(int m) -
getStartDate
-
setStartDate
-
getEndingDate
-
setEndDate
-
setStartAndEndDate
This sets the Start Date and End Date of the Contract based on the length of the contract and the starting date provided- Parameters:
startDate
- the date the contract starts at
-
getMultiplier
public double getMultiplier() -
setMultiplier
public void setMultiplier(double s) -
getTransportComp
public int getTransportComp() -
getTransportCompString
-
setTransportComp
public void setTransportComp(int s) -
getStraightSupport
public int getStraightSupport() -
getStraightSupportString
-
setStraightSupport
public void setStraightSupport(int s) -
getOverheadComp
public int getOverheadComp() -
setOverheadComp
public void setOverheadComp(int s) -
getCommandRights
-
setCommandRights
-
getBattleLossComp
public int getBattleLossComp() -
getBattleLossCompString
-
setBattleLossComp
public void setBattleLossComp(int s) -
getSalvagePct
public int getSalvagePct() -
getSalvagePctString
-
setSalvagePct
public void setSalvagePct(int s) -
isSalvageExchange
public boolean isSalvageExchange() -
setSalvageExchange
public void setSalvageExchange(boolean b) -
canSalvage
public boolean canSalvage() -
getSalvagedByUnit
-
setSalvagedByUnit
-
addSalvageByUnit
-
subtractSalvageByUnit
-
getSalvagedByEmployer
-
setSalvagedByEmployer
-
addSalvageByEmployer
-
getSigningBonusPct
public int getSigningBonusPct() -
setSigningBonusPct
public void setSigningBonusPct(int s) -
getAdvancePct
public int getAdvancePct() -
setAdvancePct
public void setAdvancePct(int s) -
payMRBCFee
public boolean payMRBCFee() -
getMrbcFeePercentage
public int getMrbcFeePercentage() -
setMRBCFee
public void setMRBCFee(boolean b) -
getTotalAmountPlusFeesAndBonuses
-
getTotalAmountPlusFees
-
getTotalAmount
-
getAdvanceAmount
-
getTotalAdvanceAmount
- Returns:
- total amount that will be paid on contract acceptance.
-
setAdvanceAmount
-
getFeeAmount
-
setFeeAmount
-
getBaseAmount
-
setBaseAmount
-
getOverheadAmount
-
setOverheadAmount
-
getSupportAmount
-
setSupportAmount
-
getTransitAmount
-
setTransitAmount
-
getTransportAmount
-
setTransportAmount
-
getSigningBonusAmount
-
setSigningBonusAmount
-
setSystemId
- Overrides:
setSystemId
in classMission
-
isActiveOn
- Overrides:
isActiveOn
in classMission
-
getJumpPath
Gets the currently calculated jump path for this contract, only recalculating if it's not valid any longer or hasn't been calculated yet. -
getCachedJumpPath
-
setCachedJumpPath
-
getMonthlyPayOut
-
getTotalMonthlyPayOut
- Parameters:
c
- campaign loaded- Returns:
- the cumulative sum the estimated monthly incomes - expenses
-
getTravelDays
Calculates the number of days required for travel based on the current campaign state.This method determines if a valid destination system is set, computes if the command circuit should be used, retrieves the jump path, and totals the travel time (including recharge, start, and end times). The result is rounded to two decimal places and then to the nearest whole day.
- Parameters:
campaign
- theCampaign
instance containing context such as date, location, and command circuit options- Returns:
- the total number of travel days required; returns 0 if there is no valid system to travel to
-
getLengthPlusTravel
- Parameters:
c
- campaign loaded- Returns:
- the approximate number of months for a 2-way trip + deployment, rounded up
-
getTotalEstimatedOverheadExpenses
- Parameters:
c
- campaign loaded- Returns:
- the cumulative sum of estimated overhead expenses for the duration of travel + deployment
-
getTotalEstimatedMaintenanceExpenses
- Parameters:
c
- campaign loaded- Returns:
- the cumulative sum of estimated maintenance expenses for the duration of travel + deployment
-
getEstimatedPayrollExpenses
- Parameters:
c
- campaign loaded- Returns:
- the estimated payroll expenses for one month
-
getTotalEstimatedPayrollExpenses
- Parameters:
c
- campaign loaded- Returns:
- the cumulative sum of estimated payroll expenses for the duration of travel + deployment
-
getTotalTransportationFees
- Parameters:
c
- campaign loaded- Returns:
- the total (2-way) estimated transportation fee from the player's current location to this contract's planet
-
getEstimatedTotalProfit
Get the estimated total profit for this contract. The total profit is the total contract payment including fees and bonuses, minus overhead, maintenance, payroll, spare parts, and other monthly expenses. The duration used for monthly expenses is the contract duration plus the travel time from the unit's current world to the contract world and back.- Parameters:
c
- The campaign with which this contract is associated.- Returns:
- The estimated profit in the current default currency.
-
getMonthsLeft
Get the number of months left in this contract after the given date. Partial months are counted as full months.- Parameters:
date
- the date to use in the calculation- Returns:
- the number of months left
-
acceptContract
Calculations to be performed once the contract has been accepted. -
calculateContract
Only do this at the time the contract is set up, otherwise amounts may change after the ink is signed, which is a no-no.- Parameters:
campaign
- current campaign
-
writeToXMLBegin
- Overrides:
writeToXMLBegin
in classMission
-
loadFieldsFromXmlNode
public void loadFieldsFromXmlNode(Campaign campaign, megamek.Version version, Node wn) throws ParseException - Overrides:
loadFieldsFromXmlNode
in classMission
- Throws:
ParseException
-