Skip to content

Commit

Permalink
Merge pull request #5227 from IllianiCBT/addTransaction
Browse files Browse the repository at this point in the history
Renamed "Add Funds" to "Add Transaction" for Clarity
  • Loading branch information
HammerGS authored Nov 23, 2024
2 parents 77704f1 + 35d17a4 commit 5a15764
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The first hired mekwarrior is the force commanding officer and gets a +1 bonus t
Meks can be generated in several ways (or not at all) although I recommend to use the system detailed in the rules file under Company_Creation for the first time. If this file is not available a roll on the Chosen Rat can be an alternative. To add a mek Marketplace -> Purchase Unit, select Unit Type "Mek" and the desired weight class finish by using the "Add (GM)" button.

Before accepting a contract it is necessary to fill out the TO&E, in order to do so mekwarriors need to be assigned to their rides, in the Personnel tab right-click on the pilot -> assign to unit -> select desired unit. As soon as all available meks are assigned to a pilot you must sort them into lances in the TO&E tab. By right-clicking on the "My Campaign" force icon new forces can be added. A 12 mek company usually consists of three lances with four meks each, every lance must be commanded by an officer. There are certain size and weight limits to lances see the rules file for more information.
The unit is now established yet there is more preparation to be done. I recommend to use "Add Funds (GM)" under the Finance tab to add some starting capital, 5%-20% of your starting net worth is reasonable. Before the cash can be spend the options turned off during creation must be turned on again.
The unit is now established yet there is more preparation to be done. I recommend to use "Add Transaction (GM)" under the Finance tab to add some starting capital, 5%-20% of your starting net worth is reasonable. Before the cash can be spend the options turned off during creation must be turned on again.

File -> Campaign Options
"Finance" Tab
Expand Down
6 changes: 3 additions & 3 deletions MekHQ/resources/mekhq/resources/AddFundsDialog.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
label.text=Funds to add :
btnAddFunds.actionCommand=AddFunds
btnAddFunds.text=Add Funds
fundsQuantityField.toolTipText=Quantity of funds to add to treasury. Negative amounts remove money.
btnAddFunds.text=Add Transaction
fundsQuantityField.toolTipText=Quantity of funds to add to the treasury. Negative amounts remove money.
fundsQuantityField.text=0
Form.title=Add Funds
Form.title=Add Transaction
52 changes: 25 additions & 27 deletions MekHQ/src/mekhq/gui/FinancesTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import mekhq.gui.model.FinanceTableModel;
import mekhq.gui.model.LoanTableModel;
import mekhq.gui.utilities.JScrollPaneWithSpeed;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
Expand Down Expand Up @@ -75,7 +74,7 @@ public final class FinancesTab extends CampaignGuiTab {
private FinanceTableModel financeModel;
private LoanTableModel loanModel;

private static final transient ResourceBundle resourceMap = ResourceBundle.getBundle("mekhq.resources.FinancesTab",
private static final ResourceBundle resourceMap = ResourceBundle.getBundle("mekhq.resources.FinancesTab",
MekHQ.getMHQOptions().getLocale());

//region Constructors
Expand Down Expand Up @@ -169,7 +168,7 @@ public void initTab() {
JPanel panelFinanceRight = new JPanel(new BorderLayout());

JPanel pnlFinanceBtns = new JPanel(new GridLayout(2, 2));
btnAddFunds = new JButton("Add Funds (GM)");
btnAddFunds = new JButton("Add Transaction (GM)");
btnAddFunds.addActionListener(ev -> addFundsActionPerformed());
btnAddFunds.setEnabled(getCampaign().isGM());
pnlFinanceBtns.add(btnAddFunds);
Expand Down Expand Up @@ -303,8 +302,7 @@ private JFreeChart createAmountChart(XYDataset dataset) {
plot.setRangeCrosshairVisible(true);

XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
if (r instanceof XYLineAndShapeRenderer renderer) {
renderer.setDefaultShapesVisible(true);
renderer.setDefaultShapesFilled(true);
renderer.setDrawSeriesLineAsPath(true);
Expand Down Expand Up @@ -401,43 +399,43 @@ public String getFormattedFinancialReport() {
longest = Math.max(
netWorth.toAmountAndSymbolString().length(),
longest);
String formatted = "%1$" + longest + "s";
String formatted = "%1$" + longest + 's';
sb.append("Net Worth................ ")
.append(String.format(formatted, netWorth.toAmountAndSymbolString())).append("\n\n");
sb.append(" Assets............... ")
.append(String.format(formatted, assets.toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, assets.toAmountAndSymbolString())).append('\n');
sb.append(" Cash.............. ")
.append(String.format(formatted, r.getCash().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getCash().toAmountAndSymbolString())).append('\n');
if (r.getMekValue().isPositive()) {
sb.append(" Meks............. ")
.append(String.format(formatted, r.getMekValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMekValue().toAmountAndSymbolString())).append('\n');
}
if (r.getVeeValue().isPositive()) {
sb.append(" Vehicles.......... ")
.append(String.format(formatted, r.getVeeValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getVeeValue().toAmountAndSymbolString())).append('\n');
}
if (r.getBattleArmorValue().isPositive()) {
sb.append(" BattleArmor....... ")
.append(String.format(formatted, r.getBattleArmorValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getBattleArmorValue().toAmountAndSymbolString())).append('\n');
}
if (r.getInfantryValue().isPositive()) {
sb.append(" Infantry.......... ")
.append(String.format(formatted, r.getInfantryValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getInfantryValue().toAmountAndSymbolString())).append('\n');
}
if (r.getProtoMekValue().isPositive()) {
sb.append(" ProtoMeks........ ")
.append(String.format(formatted, r.getProtoMekValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getProtoMekValue().toAmountAndSymbolString())).append('\n');
}
if (r.getSmallCraftValue().isPositive()) {
sb.append(" Small Craft....... ")
.append(String.format(formatted, r.getSmallCraftValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getSmallCraftValue().toAmountAndSymbolString())).append('\n');
}
if (r.getLargeCraftValue().isPositive()) {
sb.append(" Large Craft....... ")
.append(String.format(formatted, r.getLargeCraftValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getLargeCraftValue().toAmountAndSymbolString())).append('\n');
}
sb.append(" Spare Parts....... ")
.append(String.format(formatted, r.getSparePartsValue().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getSparePartsValue().toAmountAndSymbolString())).append('\n');

if (!getCampaign().getFinances().getAssets().isEmpty()) {
for (Asset asset : getCampaign().getFinances().getAssets()) {
Expand All @@ -453,37 +451,37 @@ public String getFormattedFinancialReport() {
assetName += " ";
sb.append(" ").append(assetName)
.append(String.format(formatted, asset.getValue().toAmountAndSymbolString()))
.append("\n");
.append('\n');
}
}
sb.append("\n");
sb.append('\n');
sb.append(" Liabilities.......... ")
.append(String.format(formatted, liabilities.toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, liabilities.toAmountAndSymbolString())).append('\n');
sb.append(" Loans............. ")
.append(String.format(formatted, r.getLoans().toAmountAndSymbolString())).append("\n\n\n");

sb.append("Monthly Profit........... ")
.append(String.format(formatted, r.getMonthlyIncome().minus(r.getMonthlyExpenses()).toAmountAndSymbolString()))
.append("\n\n");
sb.append("Monthly Income........... ")
.append(String.format(formatted, r.getMonthlyIncome().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMonthlyIncome().toAmountAndSymbolString())).append('\n');
sb.append(" Contract Payments.... ")
.append(String.format(formatted, r.getContracts().toAmountAndSymbolString())).append("\n\n");
sb.append("Monthly Expenses......... ")
.append(String.format(formatted, r.getMonthlyExpenses().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMonthlyExpenses().toAmountAndSymbolString())).append('\n');
sb.append(" Salaries............. ")
.append(String.format(formatted, r.getSalaries().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getSalaries().toAmountAndSymbolString())).append('\n');
sb.append(" Maintenance.......... ")
.append(String.format(formatted, r.getMaintenance().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMaintenance().toAmountAndSymbolString())).append('\n');
sb.append(" Overhead............. ")
.append(String.format(formatted, r.getOverheadCosts().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getOverheadCosts().toAmountAndSymbolString())).append('\n');
if (getCampaign().getCampaignOptions().isUsePeacetimeCost()) {
sb.append(" Spare Parts.......... ")
.append(String.format(formatted, r.getMonthlySparePartCosts().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMonthlySparePartCosts().toAmountAndSymbolString())).append('\n');
sb.append(" Training Munitions... ")
.append(String.format(formatted, r.getMonthlyAmmoCosts().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMonthlyAmmoCosts().toAmountAndSymbolString())).append('\n');
sb.append(" Fuel................. ")
.append(String.format(formatted, r.getMonthlyFuelCosts().toAmountAndSymbolString())).append("\n");
.append(String.format(formatted, r.getMonthlyFuelCosts().toAmountAndSymbolString())).append('\n');
}

return sb.toString();
Expand Down

0 comments on commit 5a15764

Please sign in to comment.