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

R2: Refit Refit #5178

Draft
wants to merge 50 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8332180
Refits - Campaign Option to allow refit kits to use existing parts
WeaverThree Oct 23, 2024
a153d6c
ReportingUtilties - surroundIf
WeaverThree Oct 24, 2024
de98dc1
ChooseRefitDialog - UI upgrade basically done until some changes to R…
WeaverThree Oct 24, 2024
74a25ad
Refit - Allow non-omni refits to omni units as Class F
WeaverThree Oct 24, 2024
0c9bfb8
ChooseRefitDialog - Fix shopping list disappearing
WeaverThree Oct 24, 2024
8e7b9f9
ChooseRefitDialog - Re-enable Go Button
WeaverThree Oct 25, 2024
f2a035e
Merge branch 'master' into wvr-refit
WeaverThree Oct 26, 2024
f131439
Merge branch 'wvr-refit-low-hanging' into wvr-refit
WeaverThree Oct 26, 2024
51d32b4
RefitClass - An Enum for Refit Types
WeaverThree Oct 26, 2024
981c736
ReportingUtilities - separateIf
WeaverThree Oct 26, 2024
8b5d04d
RefitStepType - An enum for a coming class
WeaverThree Oct 26, 2024
f45efeb
More work on enums
WeaverThree Oct 26, 2024
39d99ac
RefitStep - Initial. Handles Armor only.
WeaverThree Oct 27, 2024
04ed82d
temp
WeaverThree Oct 27, 2024
56aee72
Merge branch 'master' into wvr-refit
WeaverThree Oct 29, 2024
10e797a
Refits - Step 1: Calculate Armor
WeaverThree Oct 29, 2024
713e3bd
Refit - Dummy out stuff in RefitTest and MekLabTab re: removed methods
WeaverThree Oct 29, 2024
0d8c784
Refit - findOnly function
WeaverThree Oct 29, 2024
fbc1ecc
Refit - Armor Fixes, Location Stuff Added
WeaverThree Oct 30, 2024
be60ddc
MekLocation - getLocation and getLocationName
WeaverThree Oct 30, 2024
9a9e68e
Refit - Location Finished (?)
WeaverThree Oct 30, 2024
add4ff1
Refit - Engines
WeaverThree Oct 30, 2024
075c2b3
Refit - Excise old RefitClass implementation and drop OldCalculate
WeaverThree Oct 30, 2024
3de8db9
Refit - Fix Engine Error Issue
WeaverThree Oct 30, 2024
14f215a
Merge branch 'master' into wvr-refit
WeaverThree Oct 30, 2024
52ae6e8
Refit - Gyro and Cockpit
WeaverThree Oct 30, 2024
693fe5c
Refit - Capital Scale Armor and Aero Locations
WeaverThree Oct 30, 2024
27974cd
Unit - getHeatSinkExample
WeaverThree Oct 31, 2024
ae4be01
Unit - getUntrackedHeatSinks
WeaverThree Oct 31, 2024
3aaffe5
Refit - Untracked HeatSinks
WeaverThree Oct 31, 2024
c0e6fdf
Refit - SCCS and Actuators
WeaverThree Nov 1, 2024
1db6b3f
Refit - Ammo Bins Pt 1
WeaverThree Nov 2, 2024
c34e7d5
Refit - Ammo Bins Pt 2, Sensors, Life Support
WeaverThree Nov 2, 2024
11ab651
Refit - HeatSinks and General Equipment
WeaverThree Nov 2, 2024
5581d23
Refit - Aero LS and Transport Bay Stuff
WeaverThree Nov 3, 2024
24fd0e3
Refit - Ammo Bin Large Craft Workaround
WeaverThree Nov 3, 2024
f3ae698
Refit - Change Facing and Misc Parts Time
WeaverThree Nov 3, 2024
b2cc6f7
Refit - Show times as hours / days
WeaverThree Nov 3, 2024
1e4cc25
Refit - Case and Broken Locations
WeaverThree Nov 4, 2024
c852b6b
Merge branch 'master' into wvr-refit
WeaverThree Nov 4, 2024
78a51fc
Refit - Omni and Totals
WeaverThree Nov 5, 2024
aa57f3d
Refit - Optimize Ammo and Armor
WeaverThree Nov 6, 2024
795d815
Refit - Optimize Parts and Hide Leaves
WeaverThree Nov 6, 2024
716d11c
ChoseRefitDialog - Tweaks
WeaverThree Nov 6, 2024
388676a
Refit - Fix a couple of CodeQL issues
WeaverThree Nov 7, 2024
1499dce
Refit - Fix a couple more CodeQL
WeaverThree Nov 7, 2024
c5abe0e
Choose Refit Dialog - Set Minimum/Preferred Size
WeaverThree Nov 9, 2024
3abba96
Refit - Omni refactor
WeaverThree Nov 18, 2024
cf0b1ae
Merge branch 'master' into wvr-refit-pub
WeaverThree Nov 18, 2024
2743655
Refit - Ammo Bin Handling & One-shots
WeaverThree Nov 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ allowCanonOnlyBox.text=Only allow canon units for purchase
allowCanonOnlyBox.toolTipText=Just what it says
allowCanonRefitOnlyBox.text=Only allow canon variants as refits
allowCanonRefitOnlyBox.toolTipText=Just what it says
allowRefitFromPartsBox.text=Allow using your own parts in refit kits
allowRefitFromPartsBox.toolTipText=By default, refit kits are available as complete units only
variableTechLevelBox.text=Variable tech level
variableTechLevelBox.toolTipText=<html>If checked, the tech level for a part or unit will change depending on whether it is in <br>prototype stage (experimental), production (advanced), or common (standard).</html>
factionIntroDateBox.text=Use faction intro dates
Expand Down
27 changes: 24 additions & 3 deletions MekHQ/resources/mekhq/resources/ChooseRefitDialog.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
btnRefit.text=Acquire and Use Refit Kit
btnCustomize.text=Customize to Model
chkHideLeaves.text=Hide Leave-As-Is Steps
btnGo-Refit.text=Refit
btnGo-Customize.text=Customize
btnGo-Omni.text=Reconfigure
iWantTo.title=I want to...
noRefitsLbl.text=No refits or customizations are available at this time under this ruleset.
radRefit.text=Acquire and use a factory refit kit to change unit's model to:
radCustomize.text=Customize unit to match specifications of model:
radOmni.text=Reconfigure Omnipods to specification:
btnClose.text=Cancel
title.text=Available Refits for
refitTable.title=Available Refits
shoppingList.title=Parts Needed
neededList.title=Parts Needed
returnsList.title=Parts Returned
stepsList.title=Refit Steps
txtOldUnit.title=Current Unit
txtNewUnit.title=Selected Refit
tabUnitView.title=Unit Data
tabItemsView.title=Items Needed/Returned
stepsTable.title=Refit Steps
neededTable.title=Parts Needed
returnsTable.title=Parts to Return to Stock
tabUnitView.title=Unit Comparison
tabListView.title=Logistics Information
totals.title=Refit Totals
totals-baseTime.text=Total Base Time
totals-refitClass.text=Overall Refit Class
totals-multiplier.text=Time Multiplier
totals-final.text=Final Refit Time
61 changes: 61 additions & 0 deletions MekHQ/resources/mekhq/resources/Parts.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,64 @@ PartRepairType.MEK_LOCATION.text=Locations
PartRepairType.PHYSICAL_WEAPON.text=Physical Weapon
PartRepairType.POD_SPACE.text=Pod
PartRepairType.UNKNOWN_LOCATION.text=Error: Unknown Repair Type

# RefitClass Enum
RefitClass.NO_CHANGE.text=No Change
RefitClass.CLASS_A.text=Class A (Field)
RefitClass.CLASS_B.text=Class B (Field)
RefitClass.CLASS_C.text=Class C (Maintenance)
RefitClass.CLASS_D.text=Class D (Maintenance)
RefitClass.CLASS_E.text=Class E (Factory)
RefitClass.CLASS_F.text=Class F (Factory)
RefitClass.OMNI_RECONFIG.text=OmniPod Reconfiguration
RefitClass.PLEASE_REPAIR.text=Please Repair Unit Before Refit

RefitClass.NO_CHANGE.shortText=N/C
RefitClass.CLASS_A.shortText=A
RefitClass.CLASS_B.shortText=B
RefitClass.CLASS_C.shortText=C
RefitClass.CLASS_D.shortText=D
RefitClass.CLASS_E.shortText=E
RefitClass.CLASS_F.shortText=F
RefitClass.OMNI_RECONFIG.shortText=Omni
RefitClass.PLEASE_REPAIR.shortText=Repair

# RefitStepType Enum
RefitStepType.LEAVE.text=Leave As Is
RefitStepType.REMOVE.text=Remove
RefitStepType.CHANGE_FACING.text=Change Facing
RefitStepType.ADD.text=Add
RefitStepType.MOVE.text=Move
RefitSTepType.CHANGE.text=Change
RefitStepType.UNLOAD.text=Unload
RefitStepType.LOAD.text=Load
RefitStepType.MOVE_AMMO.text=Move Ammo
RefitStepType.REMOVE_ARMOR.text=Remove Armor
RefitStepType.ADD_ARMOR.text=Add Armor
RefitStepType.CHANGE_ARMOR_TYPE.text=Change Armor Type
RefitStepType.REMOVE_UNTRACKED_SINKS.text=Remove Untracked Heat Sinks
RefitStepType.ADD_UNTRACKED_SINKS.text=Add Untracked Heat Sinks
RefitStepType.CHANGE_UNTRACKED_SINKS.text=Change Untracked Heat Sink Type
RefitStepType.REMOVE_SCCS_SINKS.text=Remove Heat Sinks
RefitStepType.ADD_SCCS_SINKS.text=Add Heat Sinks
RefitStepType.CHANGE_SCCS_SINKS.text=Change Heat Sink Type
RefitStepType.REMOVE_CASE.text=Remove CASE
RefitStepType.ADD_CASE.text=Add CASE
RefitStepType.REMOVE_TURRET.text=Remove Turret
RefitStepType.ADD_TURRET.text=Add Turret
RefitStepType.CHANGE_STRUCTURE_TYPE.text=Change Structure/Myomer
RefitStepType.DETACH_OMNIPOD.text=Detach OmniPod
RefitStepType.ATTACH_OMNIPOD.text=Attach OmniPod
RefitStepType.MOVE_OMNIPOD.text=Move OmniPod
RefitStepType.DETACH_AMMOPOD.text=Detach Ammo OmniPod
RefitStepType.ATTACH_AMMOPOD.text=Attach Ammo OmniPod
RefitStepType.MOVE_AMMOPOD.text=Move Ammo OmniPod
RefitStepType.META.text=Meta Step
RefitStepType.ERROR.text=Error/Invalid


# Refit
RefitError.BrokenLocation.text=Can't add part to missing or irreprable location that isn't getting replaced.

# RefitSteps
RefitStepError.OmniFixedRefit.text=Changing a fixed part on an omni unit is a Class F refit.
13 changes: 13 additions & 0 deletions MekHQ/src/mekhq/campaign/CampaignOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public static String getTransitUnitName(final int unit) {
private boolean allowISPurchases;
private boolean allowCanonOnly;
private boolean allowCanonRefitOnly;
private boolean allowRefitFromParts;
private int techLevel;
private boolean variableTechLevel;
private boolean factionIntroDate;
Expand Down Expand Up @@ -709,6 +710,7 @@ public CampaignOptions() {
allowISPurchases = true;
allowCanonOnly = false;
allowCanonRefitOnly = false;
allowRefitFromParts = false;
techLevel = TECH_EXPERIMENTAL;
variableTechLevel = false;
factionIntroDate = false;
Expand Down Expand Up @@ -3824,6 +3826,14 @@ public void setAllowCanonRefitOnly(final boolean allowCanonRefitOnly) {
this.allowCanonRefitOnly = allowCanonRefitOnly;
}

public boolean isAllowRefitFromParts() {
return allowRefitFromParts;
}

public void setAllowRefitFromParts(final boolean allowRefitFromParts) {
this.allowRefitFromParts = allowRefitFromParts;
}

public boolean isVariableTechLevel() {
return variableTechLevel;
}
Expand Down Expand Up @@ -4729,6 +4739,7 @@ public void writeToXml(final PrintWriter pw, int indent) {
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "allowISPurchases", allowISPurchases);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "allowCanonOnly", allowCanonOnly);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "allowCanonRefitOnly", allowCanonRefitOnly);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "allowRefitFromParts", allowRefitFromParts);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "variableTechLevel", variableTechLevel);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "factionIntroDate", factionIntroDate);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "useAmmoByType", useAmmoByType);
Expand Down Expand Up @@ -5409,6 +5420,8 @@ public static CampaignOptions generateCampaignOptionsFromXml(Node wn, Version ve
retVal.allowCanonOnly = Boolean.parseBoolean(wn2.getTextContent().trim());
} else if (wn2.getNodeName().equalsIgnoreCase("allowCanonRefitOnly")) {
retVal.allowCanonRefitOnly = Boolean.parseBoolean(wn2.getTextContent().trim());
} else if (wn2.getNodeName().equalsIgnoreCase("allowRefitFromParts")) {
retVal.allowRefitFromParts = Boolean.parseBoolean(wn2.getTextContent().trim());
} else if (wn2.getNodeName().equalsIgnoreCase("useAmmoByType")) {
retVal.useAmmoByType = Boolean.parseBoolean(wn2.getTextContent().trim());
} else if (wn2.getNodeName().equalsIgnoreCase("variableTechLevel")) {
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/campaign/parts/AeroLifeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public boolean isForFighter() {

@Override
public boolean isSamePartType(Part part) {
return part instanceof AeroLifeSupport && fighter == ((AeroLifeSupport) part).isForFighter()
return part instanceof AeroLifeSupport && (fighter == ((AeroLifeSupport) part).isForFighter())
&& (getStickerPrice().equals(part.getStickerPrice()));
}

Expand Down
10 changes: 6 additions & 4 deletions MekHQ/src/mekhq/campaign/parts/Armor.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import megamek.common.Dropship;
import megamek.common.Entity;
import megamek.common.EquipmentType;
import megamek.common.IArmorState;
Expand Down Expand Up @@ -408,12 +409,13 @@ public int getBaseTimeFor(Entity entity) {
if (null != entity) {
if (entity instanceof Tank) {
return 3;
}
// December 2017 errata, only large craft should return 15m/point.
else if (entity.hasETypeFlag(Entity.ETYPE_DROPSHIP) || entity.hasETypeFlag(Entity.ETYPE_JUMPSHIP)) {
} else if (entity instanceof Dropship) {
return 15;
}
} else if (entity.isCapitalScale()) {
return 120;
}
}
// Meks, protomeks, battle armor, and normal aerospace
return 5;
}

Expand Down
Loading
Loading