Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show dry cost in Status bar and full cost in tooltip #1066

Merged
merged 1 commit into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions megameklab/src/megameklab/ui/battleArmor/BAStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public void refresh() {
final double maxKilos = getBattleArmor().getTrooperWeight() * 1000;
double currentKilos;
final int bv = getBattleArmor().calculateBattleValue();
final long currentCost = Math.round(getBattleArmor().getCost(false));

TestBattleArmor testBA = new TestBattleArmor(getBattleArmor(), entityVerifier.baOption,
null);
Expand All @@ -126,7 +125,10 @@ public void refresh() {
move.setText("Movement: " + walk + "/" + jump);
move.setToolTipText("Walk/Jump MP");

cost.setText("Squad Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

StringBuffer sb = new StringBuffer();
invalid.setVisible(!testBA.correctEntity(sb));
invalid.setToolTipText("<html>" + sb.toString().replaceAll("\n", "<br/>") + "</html>");
Expand Down
5 changes: 3 additions & 2 deletions megameklab/src/megameklab/ui/combatVehicle/CVStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public void refresh() {
currentTonnage = testEntity.calculateWeight();

currentTonnage += UnitUtil.getUnallocatedAmmoTonnage(getTank());
long currentCost = Math.round(getTank().getCost(false));

tons.setText(String.format("Tonnage: %.1f/%.1f (%.1f Remaining)", currentTonnage, tonnage, tonnage - currentTonnage));
tons.setToolTipText("Current Tonnage/Max Tonnage");
Expand All @@ -155,7 +154,9 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

move.setText("Movement: " + walk + "/" + run + "/" + jump);
move.setToolTipText("Walk/Run/Jump MP");
Expand Down
6 changes: 4 additions & 2 deletions megameklab/src/megameklab/ui/fighterAero/ASStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public void refresh() {
double tonnage = getAero().getWeight();
double currentTonnage;
int bv = getAero().calculateBattleValue();
long currentCost = Math.round(getAero().getCost(false));

TestAero testAero = new TestAero(getAero(), entityVerifier.aeroOption, null);

Expand Down Expand Up @@ -107,7 +106,10 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

StringBuffer sb = new StringBuffer();
invalid.setVisible(!testAero.correctEntity(sb));
invalid.setToolTipText("<html>" + sb.toString().replaceAll("\n", "<br/>") + "</html>");
Expand Down
6 changes: 4 additions & 2 deletions megameklab/src/megameklab/ui/infantry/CIStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public void refresh() {
DecimalFormat roundFormat = new DecimalFormat("#.##");
double currentTonnage;
int bv = getInfantry().calculateBattleValue();
long currentCost = Math.round(getInfantry().getCost(false));

currentTonnage = getInfantry().getWeight();

Expand All @@ -96,7 +95,10 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

String str = UnitUtil.validateUnit(getInfantry());
invalid.setVisible(!str.isEmpty());
invalid.setToolTipText("<html>" + str.replaceAll("\n", "<br/>") + "</html>");
Expand Down
6 changes: 4 additions & 2 deletions megameklab/src/megameklab/ui/largeAero/DSStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public void refresh() {
double tonnage = getSmallCraft().getWeight();
double currentTonnage;
int bv = getSmallCraft().calculateBattleValue();
long currentCost = Math.round(getSmallCraft().getCost(false));

TestSmallCraft testSmallCraft = new TestSmallCraft(getSmallCraft(), entityVerifier.aeroOption, null);

Expand Down Expand Up @@ -111,7 +110,10 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

StringBuffer sb = new StringBuffer();
invalid.setVisible(!testSmallCraft.correctEntity(sb));
invalid.setToolTipText("<html>" + sb.toString().replaceAll("\n", "<br/>") + "</html>");
Expand Down
8 changes: 5 additions & 3 deletions megameklab/src/megameklab/ui/largeAero/WSStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public void refresh() {
double tonnage = getJumpship().getWeight();
double currentTonnage;
int bv = getJumpship().calculateBattleValue();
long currentCost = Math.round(getJumpship().getCost(false));


TestAdvancedAerospace testAdvAero = new TestAdvancedAerospace(getJumpship(), entityVerifier.aeroOption, null);
currentTonnage = testAdvAero.calculateWeight();
currentTonnage += UnitUtil.getUnallocatedAmmoTonnage(getJumpship());
Expand Down Expand Up @@ -116,7 +115,10 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

StringBuffer sb = new StringBuffer();
invalid.setVisible(!testAdvAero.correctEntity(sb));
invalid.setToolTipText("<html>" + sb.toString().replaceAll("\n", "<br/>") + "</html>");
Expand Down
5 changes: 3 additions & 2 deletions megameklab/src/megameklab/ui/mek/BMStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void refresh() {
maxCrits = 78;
}
int currentCrits = UnitUtil.countUsedCriticals(getMech());
long currentCost = Math.round(getMech().getCost(false));

testEntity = new TestMech(getMech(), entityVerifier.mechOption, null);

Expand All @@ -106,7 +105,9 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

crits.setText("Criticals: " + currentCrits + " / " + maxCrits);
crits.setForeground(currentCrits > maxCrits ? GUIPreferences.getInstance().getWarningColor() : null);
Expand Down
5 changes: 3 additions & 2 deletions megameklab/src/megameklab/ui/protoMek/PMStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public void refresh() {
}
long currentCrits = getProtomech().getEquipment().stream()
.filter(m -> TestProtomech.requiresSlot(m.getType())).count();
long currentCost = Math.round(getProtomech().getCost(false));

currentTonnage = testEntity.calculateWeight() * 1000;

Expand All @@ -99,7 +98,9 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

crits.setText("Criticals: " + currentCrits + "/" + maxCrits);
if(currentCrits > maxCrits) {
Expand Down
5 changes: 3 additions & 2 deletions megameklab/src/megameklab/ui/supportVehicle/SVStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public void refresh() {
currentTonnage = testEntity.calculateWeight();

currentTonnage += UnitUtil.getUnallocatedAmmoTonnage(eSource.getEntity());
long currentCost = Math.round(eSource.getEntity().getCost(false));

if (eSource.getEntity().getWeightClass() == EntityWeightClass.WEIGHT_SMALL_SUPPORT) {
tons.setText(String.format("Tonnage: %.0f/%.0f (%.0f Remaining)",
Expand All @@ -158,7 +157,9 @@ public void refresh() {
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");

cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
cost.setText("Dry Cost: " + formatter.format(Math.round(getEntity().getCost(true))) + " C-bills");
cost.setToolTipText("The dry cost of the unit (without ammo). The unit's full cost is "
+ formatter.format(Math.round(getEntity().getCost(false))) + " C-bills.");

move.setText("Movement: " + walk + "/" + run + "/" + jump);
move.setToolTipText("Walk/Run/Jump MP");
Expand Down