Search in sources :

Example 6 with AmmoType

use of megamek.common.AmmoType in project megameklab by MegaMek.

the class ImageHelperVehicle method printVTOLWeaponsNEquipment.

public static void printVTOLWeaponsNEquipment(Tank tank, Graphics2D g2d, float offsetY, float offsetX) {
    float qtyPoint = 26 + offsetX;
    float typePoint = 38 + offsetX;
    float locPoint = 127 + offsetX;
    float damagePoint = 150 + offsetX;
    float minPoint = 166 + offsetX;
    float shtPoint = 177 + offsetX;
    float medPoint = 195 + offsetX;
    float longPoint = 211 + offsetX;
    float maxHeight = 130.3f;
    float linePoint = 202f + offsetY;
    float lineFeed = 6.7f;
    boolean newLineNeeded = false;
    ArrayList<Hashtable<String, EquipmentInfo>> equipmentLocations = new ArrayList<Hashtable<String, EquipmentInfo>>(tank.getLocTurret() + 1);
    for (int pos = 0; pos <= tank.locations(); pos++) {
        equipmentLocations.add(pos, new Hashtable<String, EquipmentInfo>());
    }
    for (Mounted eq : tank.getEquipment()) {
        if ((eq.getType() instanceof AmmoType) || (eq.getLocation() == Entity.LOC_NONE) || !UnitUtil.isPrintableEquipment(eq.getType(), false)) {
            continue;
        }
        Hashtable<String, EquipmentInfo> eqHash = equipmentLocations.get(eq.getLocation());
        String equipmentName = eq.getName();
        if (eq.isRearMounted()) {
            equipmentName += "(R)";
        }
        if (eqHash.containsKey(equipmentName)) {
            EquipmentInfo eqi = eqHash.get(equipmentName);
            if (eq.getType().getTechLevel(tank.getTechLevelYear()) != eqi.techLevel) {
                eqi = new EquipmentInfo(tank, eq);
            } else {
                eqi.count++;
            }
            eqHash.put(equipmentName, eqi);
        } else {
            EquipmentInfo eqi = new EquipmentInfo(tank, eq);
            eqHash.put(equipmentName, eqi);
        }
    }
    if (tank.getTroopCarryingSpace() > 0) {
        maxHeight -= lineFeed;
    }
    if (tank.hasWorkingMisc(MiscType.F_CHASSIS_MODIFICATION)) {
        maxHeight -= lineFeed;
    }
    for (@SuppressWarnings("unused") Bay bay : tank.getTransportBays()) {
        maxHeight -= lineFeed;
    }
    g2d.setFont(UnitUtil.deriveFont(false, 7.0f));
    Font font = ImageHelperVehicle.getVehicleWeaponsNEquipmentFont(g2d, false, maxHeight, equipmentLocations, 7.0f);
    g2d.setFont(font);
    float stringHeight = ImageHelper.getStringHeight(g2d, "H", font);
    lineFeed = stringHeight;
    for (int pos = Tank.LOC_BODY; pos <= tank.locations(); pos++) {
        Hashtable<String, EquipmentInfo> eqHash = equipmentLocations.get(pos);
        if (eqHash.size() < 1) {
            continue;
        }
        ArrayList<EquipmentInfo> equipmentList = new ArrayList<EquipmentInfo>();
        EquipmentInfo artemisEQ = null;
        if (eqHash.containsKey("Artemis IV FCS")) {
            artemisEQ = eqHash.get("Artemis IV FCS");
            artemisEQ.count = 1;
            eqHash.remove("Artemis IV FCS");
        }
        for (EquipmentInfo eqi : eqHash.values()) {
            equipmentList.add(eqi);
        }
        Collections.sort(equipmentList, StringUtils.equipmentInfoComparator());
        for (int eqPos = 0; eqPos < equipmentList.size(); eqPos++) {
            EquipmentInfo eqi = equipmentList.get(eqPos);
            if ((eqi.isMML || (eqi.name.indexOf("LRM") > -1) || (eqi.name.indexOf("SRM") > -1)) && (artemisEQ != null)) {
                equipmentList.add(++eqPos, artemisEQ);
            }
        }
        for (EquipmentInfo eqi : equipmentList) {
            newLineNeeded = false;
            g2d.drawString(Integer.toString(eqi.count), qtyPoint, linePoint);
            String name = eqi.name.trim();
            g2d.setFont(UnitUtil.getNewFont(g2d, name, false, 65, font.getSize2D()));
            if (eqi.c3Level == EquipmentInfo.C3I) {
                ImageHelper.printC3iName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3EM) {
                ImageHelper.printC3EmName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3S) {
                ImageHelper.printC3sName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3M) {
                ImageHelper.printC3mName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3SB) {
                ImageHelper.printC3sbName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3MB) {
                ImageHelper.printC3mbName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3REMOTESENSOR) {
                ImageHelper.printC3RemoteSensorName(g2d, typePoint, linePoint, font, false, tank.isMixedTech() && TechConstants.isClan(tank.getTechLevel()));
            } else if (eqi.isMashCore) {
                ImageHelper.printMashCore(g2d, typePoint, linePoint, font, false, tank);
            } else if (eqi.isDroneControl) {
                ImageHelper.printDroneControl(g2d, typePoint, linePoint, font, false, tank);
            } else {
                g2d.drawString(name, typePoint, linePoint);
            }
            g2d.setFont(font);
            String location = tank.getLocationAbbr(pos);
            g2d.drawString(location, locPoint, linePoint);
            if (eqi.isWeapon) {
                if (eqi.isMML) {
                    ImageHelper.printCenterString(g2d, "[M,S,C]", font, damagePoint, linePoint);
                    linePoint += lineFeed - 1.0f;
                    g2d.drawString("LRM", typePoint, linePoint);
                    ImageHelper.printCenterString(g2d, "1/Msl", font, damagePoint, linePoint);
                    g2d.drawString("6", minPoint, linePoint);
                    g2d.drawString("7", shtPoint, linePoint);
                    g2d.drawString("14", medPoint, linePoint);
                    g2d.drawString("21", longPoint, linePoint);
                    linePoint += lineFeed - 1.0f;
                    g2d.drawString("SRM", typePoint, linePoint);
                    ImageHelper.printCenterString(g2d, "2/Msl", font, damagePoint, linePoint);
                    g2d.drawString("\u2014", minPoint, linePoint);
                    // g2d.drawLine(minPoint, (int) linePoint - 2, minPoint + 6, (int) linePoint - 2);
                    g2d.drawString("3", shtPoint, linePoint);
                    g2d.drawString("6", medPoint, linePoint);
                    g2d.drawString("9", longPoint, linePoint);
                } else if (eqi.isATM) {
                    ImageHelper.printCenterString(g2d, "[M,S,C]", font, damagePoint, linePoint);
                    linePoint += lineFeed - 1.0f;
                    g2d.drawString("Standard", typePoint, linePoint);
                    ImageHelper.printCenterString(g2d, "2/Msl", font, damagePoint, linePoint);
                    g2d.drawString("4", minPoint, linePoint);
                    g2d.drawString("5", shtPoint, linePoint);
                    g2d.drawString("10", medPoint, linePoint);
                    g2d.drawString("15", longPoint, linePoint);
                    linePoint += lineFeed - 1.0f;
                    g2d.drawString("Extended-Range", typePoint, linePoint);
                    ImageHelper.printCenterString(g2d, "1/Msl", font, damagePoint, linePoint);
                    g2d.drawString("4", minPoint, linePoint);
                    g2d.drawString("9", shtPoint, linePoint);
                    g2d.drawString("18", medPoint, linePoint);
                    g2d.drawString("27", longPoint, linePoint);
                    linePoint += lineFeed - 1.0f;
                    g2d.drawString("High-Explosive", typePoint, linePoint);
                    ImageHelper.printCenterString(g2d, "3/Msl", font, damagePoint, linePoint);
                    g2d.drawString("\u2014", minPoint, linePoint);
                    // g2d.drawLine(minPoint, (int) linePoint - 2, minPoint + 6, (int) linePoint - 2);
                    g2d.drawString("3", shtPoint, linePoint);
                    g2d.drawString("6", medPoint, linePoint);
                    g2d.drawString("9", longPoint, linePoint);
                } else {
                    if (ImageHelper.getStringWidth(g2d, eqi.damage.trim(), font) > 22) {
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(0, eqi.damage.indexOf('[')), font, damagePoint, linePoint);
                        Font smallFont = UnitUtil.deriveFont(font.getSize2D() - 1.0f);
                        g2d.setFont(smallFont);
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(eqi.damage.indexOf('[')), smallFont, damagePoint, (linePoint + lineFeed) - 1.0f);
                        newLineNeeded = true;
                        g2d.setFont(font);
                    } else {
                        ImageHelper.printCenterString(g2d, eqi.damage, font, damagePoint, linePoint);
                    }
                    if (eqi.minRange > 0) {
                        g2d.drawString(Integer.toString(eqi.minRange), minPoint, linePoint);
                    } else {
                        g2d.drawString("\u2014", minPoint, linePoint);
                    // g2d.drawLine(minPoint, (int) linePoint - 2, minPoint + 6, (int) linePoint - 2);
                    }
                    g2d.drawString(Integer.toString(eqi.shtRange), shtPoint, linePoint);
                    g2d.drawString(Integer.toString(eqi.medRange), medPoint, linePoint);
                    if (eqi.longRange > 0) {
                        g2d.drawString(Integer.toString(eqi.longRange), longPoint, (int) linePoint);
                    } else {
                        g2d.drawString("\u2014", longPoint, linePoint);
                    // g2d.drawLine(longPoint, (int) linePoint - 2, longPoint + 6, (int) linePoint - 2);
                    }
                }
            } else {
                ImageHelper.printCenterString(g2d, eqi.damage, font, damagePoint - 2, linePoint);
                g2d.drawString("\u2014", minPoint, linePoint);
                g2d.drawString("\u2014", shtPoint, linePoint);
                g2d.drawString("\u2014", medPoint, linePoint);
                // g2d.drawLine(medPoint, (int) linePoint - 2, medPoint + 6, (int) linePoint - 2);
                if (eqi.longRange > 0) {
                    g2d.drawString(Integer.toString(eqi.longRange), longPoint, (int) linePoint);
                } else {
                    g2d.drawString("\u2014", longPoint, linePoint);
                // g2d.drawLine(longPoint, (int) linePoint - 2, longPoint + 6, (int) linePoint - 2);
                }
            }
            linePoint += lineFeed;
            if (newLineNeeded) {
                linePoint += lineFeed;
            }
        }
    }
    double troopspace = tank.getTroopCarryingSpace();
    if (troopspace > 0) {
        linePoint += lineFeed;
        String troopString = "Infantry Compartment(";
        if ((troopspace - Math.floor(troopspace)) > 0) {
            troopString += String.valueOf(troopspace);
        } else {
            troopString += String.valueOf((int) troopspace);
        }
        if (troopspace == 1) {
            troopString += " ton)";
        } else {
            troopString += " tons)";
        }
        g2d.drawString(troopString, qtyPoint, linePoint);
    }
    for (Bay bay : tank.getTransportBays()) {
        linePoint += lineFeed;
        g2d.drawString(ImageHelperVehicle.getBayString(bay), qtyPoint, linePoint);
    }
    if (tank.hasWorkingMisc(MiscType.F_CHASSIS_MODIFICATION)) {
        linePoint += lineFeed;
        String chassisMods = "Chassis Modifications: ";
        for (Mounted misc : tank.getMisc()) {
            if (misc.getType().hasFlag(MiscType.F_CHASSIS_MODIFICATION)) {
                chassisMods += misc.getName() + ", ";
            }
        }
        chassisMods = chassisMods.substring(0, chassisMods.length() - 2);
        g2d.drawString(chassisMods, qtyPoint, linePoint);
    }
    ImageHelper.printVehicleAmmo(tank, g2d, (int) offsetY, (int) offsetX);
}
Also used : Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) Font(java.awt.Font) AmmoType(megamek.common.AmmoType) Mounted(megamek.common.Mounted) Bay(megamek.common.Bay)

Example 7 with AmmoType

use of megamek.common.AmmoType in project megameklab by MegaMek.

the class DropTargetCriticalList method mousePressed.

public void mousePressed(MouseEvent e) {
    if (buildView) {
        if (e.getButton() == MouseEvent.BUTTON2) {
            setSelectedIndex(locationToIndex(e.getPoint()));
            removeCrit();
        } else if (e.getButton() == MouseEvent.BUTTON3) {
            setSelectedIndex(locationToIndex(e.getPoint()));
            if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {
                removeCrit();
                return;
            }
            int location = getCritLocation();
            JPopupMenu popup = new JPopupMenu();
            CriticalSlot cs = getCrit();
            final Mounted mount = getMounted();
            if ((e.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) {
                changeWeaponFacing(!mount.isRearMounted());
                return;
            }
            if (mount != null && (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0) {
                changeOmniMounting(!mount.isOmniPodMounted());
                return;
            }
            if (mount != null && !((getUnit().getEntityType() & Entity.ETYPE_QUADVEE) == Entity.ETYPE_QUADVEE && mount.getType() instanceof MiscType && mount.getType().hasFlag(MiscType.F_TRACKS))) {
                JMenuItem info;
                if (!UnitUtil.isFixedLocationSpreadEquipment(mount.getType())) {
                    popup.setAutoscrolls(true);
                    info = new JMenuItem("Remove " + mount.getName());
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            removeCrit();
                        }
                    });
                    popup.add(info);
                }
                info = new JMenuItem("Delete " + mount.getName());
                info.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent e) {
                        removeMount();
                    }
                });
                if (!((getUnit() instanceof BattleArmor) && UnitUtil.isFixedLocationSpreadEquipment(mount.getType()))) {
                    popup.add(info);
                }
                // Allow making this a sort weapon
                if ((mount.getType() instanceof WeaponType) && !mount.isSquadSupportWeapon() && mount.getLocation() == BattleArmor.LOC_SQUAD && (getUnit() instanceof BattleArmor) && ((BattleArmor) getUnit()).getChassisType() != BattleArmor.CHASSIS_TYPE_QUAD) {
                    info = new JMenuItem("Mount as squad support weapon");
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            mount.setSquadSupportWeapon(true);
                            if (refresh != null) {
                                refresh.refreshAll();
                            }
                        }
                    });
                    popup.add(info);
                }
                // Adding ammo as a squad support mount is slightly different
                if ((mount.getType() instanceof AmmoType) && !mount.getType().hasFlag(WeaponType.F_MISSILE) && !mount.isSquadSupportWeapon() && mount.getLocation() == BattleArmor.LOC_SQUAD && (getUnit() instanceof BattleArmor) && ((BattleArmor) getUnit()).getChassisType() != BattleArmor.CHASSIS_TYPE_QUAD) {
                    boolean enabled = false;
                    for (Mounted weapon : getUnit().getWeaponList()) {
                        WeaponType wtype = (WeaponType) weapon.getType();
                        if (weapon.isSquadSupportWeapon() && AmmoType.isAmmoValid(mount, wtype)) {
                            enabled = true;
                        }
                    }
                    info = new JMenuItem("Mount as squad support weapon");
                    info.setEnabled(enabled);
                    info.setToolTipText("Ammo can only be squad mounted along " + "with a weapon that uses it");
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            mount.setSquadSupportWeapon(true);
                            if (refresh != null) {
                                refresh.refreshAll();
                            }
                        }
                    });
                    popup.add(info);
                }
                // Allow removing squad support weapon
                if (mount.isSquadSupportWeapon()) {
                    info = new JMenuItem("Remove squad support weapon mount");
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            mount.setSquadSupportWeapon(false);
                            // squad support weapon
                            for (Mounted ammo : getUnit().getAmmo()) {
                                ammo.setSquadSupportWeapon(false);
                            }
                            if (refresh != null) {
                                refresh.refreshAll();
                            }
                        }
                    });
                    popup.add(info);
                }
                // Right-clicked on a DWP that has an attached weapon
                if (mount.getType().hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK) && mount.getLinked() != null) {
                    info = new JMenuItem("Remove attached weapon");
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            Mounted attached = mount.getLinked();
                            attached.setDWPMounted(false);
                            mount.setLinked(null);
                            mount.setLinkedBy(null);
                            attached.setLinked(null);
                            attached.setLinkedBy(null);
                            if (refresh != null) {
                                refresh.refreshAll();
                            }
                        }
                    });
                    popup.add(info);
                }
                // Right-clicked on a AP Mount that has an attached weapon
                if (mount.getType().hasFlag(MiscType.F_AP_MOUNT) && mount.getLinked() != null) {
                    info = new JMenuItem("Remove attached weapon");
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            Mounted attached = mount.getLinked();
                            attached.setAPMMounted(false);
                            mount.setLinked(null);
                            mount.setLinkedBy(null);
                            attached.setLinked(null);
                            attached.setLinkedBy(null);
                            if (refresh != null) {
                                refresh.refreshAll();
                            }
                        }
                    });
                    popup.add(info);
                }
                if ((mount.getLocation() != Mech.LOC_LARM) && (mount.getLocation() != Mech.LOC_RARM)) {
                    if (mount.getType() instanceof WeaponType) {
                        if (getUnit().hasWorkingMisc(MiscType.F_QUAD_TURRET, -1, mount.getLocation()) || getUnit().hasWorkingMisc(MiscType.F_SHOULDER_TURRET, -1, mount.getLocation()) || (getUnit().hasWorkingMisc(MiscType.F_HEAD_TURRET, -1, Mech.LOC_CT) && (mount.getLocation() == Mech.LOC_HEAD))) {
                            if (!mount.isMechTurretMounted()) {
                                info = new JMenuItem("Mount " + mount.getName() + " in Turret");
                                info.addActionListener(new ActionListener() {

                                    public void actionPerformed(ActionEvent e) {
                                        changeTurretMount(true);
                                    }
                                });
                                popup.add(info);
                            } else {
                                info = new JMenuItem("Remove " + mount.getName() + " from Turret");
                                info.addActionListener(new ActionListener() {

                                    public void actionPerformed(ActionEvent e) {
                                        changeTurretMount(false);
                                    }
                                });
                                popup.add(info);
                            }
                        }
                    }
                    if (!(getUnit() instanceof BattleArmor) && ((mount.getType() instanceof WeaponType) || ((mount.getType() instanceof MiscType) && mount.getType().hasFlag(MiscType.F_LIFTHOIST)))) {
                        if (!mount.isRearMounted()) {
                            info = new JMenuItem("Make " + mount.getName() + " Rear Facing");
                            info.addActionListener(new ActionListener() {

                                public void actionPerformed(ActionEvent e) {
                                    changeWeaponFacing(true);
                                }
                            });
                            popup.add(info);
                        } else {
                            info = new JMenuItem("Make " + mount.getName() + " Forward Facing");
                            info.addActionListener(new ActionListener() {

                                public void actionPerformed(ActionEvent e) {
                                    changeWeaponFacing(false);
                                }
                            });
                            popup.add(info);
                        }
                    }
                }
                // Allow number of shots selection
                if ((getUnit() instanceof BattleArmor) && mount.getType() instanceof AmmoType) {
                    AmmoType at = (AmmoType) mount.getType();
                    int maxNumShots = TestBattleArmor.NUM_SHOTS_PER_CRIT;
                    int stepSize = 1;
                    if (at.getAmmoType() == AmmoType.T_BA_TUBE) {
                        maxNumShots = TestBattleArmor.NUM_SHOTS_PER_CRIT_TA;
                        stepSize = 2;
                    }
                    for (int i = at.getShots(); i <= maxNumShots; i += stepSize) {
                        if (i == mount.getBaseShotsLeft()) {
                            continue;
                        }
                        info = new JMenuItem("Set Shots: " + i);
                        final int shots = i;
                        info.addActionListener(new ActionListener() {

                            public void actionPerformed(ActionEvent e) {
                                mount.setShotsLeft(shots);
                                if (refresh != null) {
                                    refresh.refreshAll();
                                }
                            }
                        });
                        popup.add(info);
                    }
                }
                if (getUnit().isOmni() && !mount.getType().isOmniFixedOnly()) {
                    if (mount.isOmniPodMounted()) {
                        info = new JMenuItem("Change to fixed mount");
                        info.addActionListener(ev -> changeOmniMounting(false));
                        popup.add(info);
                    } else if (UnitUtil.canPodMount(getUnit(), mount)) {
                        info = new JMenuItem("Change to pod mount");
                        info.addActionListener(ev -> changeOmniMounting(true));
                        popup.add(info);
                    }
                }
            }
            if ((getUnit() instanceof BipedMech || getUnit() instanceof TripodMech) && ((location == Mech.LOC_LARM) || (location == Mech.LOC_RARM))) {
                boolean canHaveLowerArm = true;
                if (getUnit().isOmni()) {
                    int numCrits = getUnit().getNumberOfCriticals(location);
                    for (int slot = 0; slot < numCrits; slot++) {
                        CriticalSlot crit = getUnit().getCritical(location, slot);
                        if (crit == null) {
                            continue;
                        }
                        if (crit.getType() == CriticalSlot.TYPE_SYSTEM) {
                            continue;
                        }
                        Mounted m = crit.getMount();
                        if ((m.getType() instanceof GaussWeapon) || (m.getType() instanceof ACWeapon) || (m.getType() instanceof UACWeapon) || (m.getType() instanceof LBXACWeapon) || (m.getType() instanceof PPCWeapon)) {
                            canHaveLowerArm = false;
                        }
                    }
                }
                popup.addSeparator();
                popup.setAutoscrolls(true);
                if (canHaveLowerArm && ((getUnit().getCritical(location, 3) == null) || (getUnit().getCritical(location, 3).getType() != CriticalSlot.TYPE_SYSTEM))) {
                    JMenuItem info = new JMenuItem("Add Hand");
                    info.setActionCommand(Integer.toString(location));
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            addHand(Integer.parseInt(e.getActionCommand()));
                        }
                    });
                    popup.add(info);
                } else if ((getUnit().getCritical(location, 3) != null) && (getUnit().getCritical(location, 3).getType() == CriticalSlot.TYPE_SYSTEM)) {
                    JMenuItem info = new JMenuItem("Remove Hand");
                    info.setActionCommand(Integer.toString(location));
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            removeHand(Integer.parseInt(e.getActionCommand()));
                        }
                    });
                    popup.add(info);
                }
                if (canHaveLowerArm && ((getUnit().getCritical(location, 2) == null) || (getUnit().getCritical(location, 2).getType() != CriticalSlot.TYPE_SYSTEM))) {
                    JMenuItem info = new JMenuItem("Add Lower Arm");
                    info.setActionCommand(Integer.toString(location));
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            addArm(Integer.parseInt(e.getActionCommand()));
                        }
                    });
                    popup.add(info);
                } else if ((getUnit().getCritical(location, 2) != null) && (getUnit().getCritical(location, 2).getType() == CriticalSlot.TYPE_SYSTEM)) {
                    JMenuItem info = new JMenuItem("Remove Lower Arm");
                    info.setActionCommand(Integer.toString(location));
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            removeArm(Integer.parseInt(e.getActionCommand()));
                        }
                    });
                    popup.add(info);
                }
            }
            if (UnitUtil.isArmorable(cs) && !(getUnit() instanceof BattleArmor) && eSource.getTechManager().isLegal(Entity.getArmoredComponentTechAdvancement())) {
                popup.addSeparator();
                if (cs.isArmored()) {
                    JMenuItem info = new JMenuItem("Remove Armoring");
                    info.setActionCommand(Integer.toString(location));
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            changeArmoring();
                        }
                    });
                    popup.add(info);
                } else if (!(getUnit() instanceof Mech && ((Mech) getUnit()).isSuperHeavy())) {
                    JMenuItem info = new JMenuItem("Add Armoring");
                    info.setActionCommand(Integer.toString(location));
                    info.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            changeArmoring();
                        }
                    });
                    popup.add(info);
                }
            }
            if (popup.getComponentCount() > 0) {
                popup.show(this, e.getX(), e.getY());
            }
        }
    }
}
Also used : InputEvent(java.awt.event.InputEvent) ActionListener(java.awt.event.ActionListener) CritListCellRenderer(megameklab.com.util.CritListCellRenderer) CriticalSlot(megamek.common.CriticalSlot) EntityLoadingException(megamek.common.loaders.EntityLoadingException) EntitySource(megameklab.com.ui.EntitySource) Vector(java.util.Vector) BattleArmor(megamek.common.BattleArmor) JMenuItem(javax.swing.JMenuItem) BipedMech(megamek.common.BipedMech) Mounted(megamek.common.Mounted) UnitUtil(megameklab.com.util.UnitUtil) TestBattleArmor(megamek.common.verifier.TestBattleArmor) MouseListener(java.awt.event.MouseListener) MechFileParser(megamek.common.MechFileParser) AmmoType(megamek.common.AmmoType) Mech(megamek.common.Mech) GaussWeapon(megamek.common.weapons.gaussrifles.GaussWeapon) JPopupMenu(javax.swing.JPopupMenu) JList(javax.swing.JList) ActionEvent(java.awt.event.ActionEvent) MouseEvent(java.awt.event.MouseEvent) LBXACWeapon(megamek.common.weapons.autocannons.LBXACWeapon) WeaponType(megamek.common.WeaponType) PPCWeapon(megamek.common.weapons.ppc.PPCWeapon) MiscType(megamek.common.MiscType) TripodMech(megamek.common.TripodMech) ACWeapon(megamek.common.weapons.autocannons.ACWeapon) UACWeapon(megamek.common.weapons.autocannons.UACWeapon) Entity(megamek.common.Entity) RefreshListener(megameklab.com.util.RefreshListener) TripodMech(megamek.common.TripodMech) CriticalSlot(megamek.common.CriticalSlot) ActionEvent(java.awt.event.ActionEvent) MiscType(megamek.common.MiscType) UACWeapon(megamek.common.weapons.autocannons.UACWeapon) PPCWeapon(megamek.common.weapons.ppc.PPCWeapon) JPopupMenu(javax.swing.JPopupMenu) AmmoType(megamek.common.AmmoType) ActionListener(java.awt.event.ActionListener) Mounted(megamek.common.Mounted) WeaponType(megamek.common.WeaponType) GaussWeapon(megamek.common.weapons.gaussrifles.GaussWeapon) BipedMech(megamek.common.BipedMech) Mech(megamek.common.Mech) TripodMech(megamek.common.TripodMech) LBXACWeapon(megamek.common.weapons.autocannons.LBXACWeapon) JMenuItem(javax.swing.JMenuItem) BipedMech(megamek.common.BipedMech) LBXACWeapon(megamek.common.weapons.autocannons.LBXACWeapon) ACWeapon(megamek.common.weapons.autocannons.ACWeapon) UACWeapon(megamek.common.weapons.autocannons.UACWeapon) BattleArmor(megamek.common.BattleArmor) TestBattleArmor(megamek.common.verifier.TestBattleArmor)

Example 8 with AmmoType

use of megamek.common.AmmoType in project megameklab by MegaMek.

the class StringUtils method getEquipmentInfo.

public static String getEquipmentInfo(Dropship unit, Mounted mount, Mounted bay) {
    String info = "";
    if (mount.getType() instanceof WeaponType) {
        WeaponType weapon = (WeaponType) mount.getType();
        if (weapon.getAmmoType() == AmmoType.T_AR10) {
            int barracudaAmmo = 0;
            int killerwhaleAmmo = 0;
            int whitesharkAmmo = 0;
            for (int ammoIndex : bay.getBayAmmo()) {
                Mounted ammoMount = unit.getEquipment(ammoIndex);
                try {
                    AmmoType aType = (AmmoType) ammoMount.getType();
                    if ((mount.getLinked() != null) && (aType.getRackSize() == weapon.getRackSize()) && (aType.getAmmoType() == weapon.getAmmoType())) {
                        if (aType.hasFlag(AmmoType.F_AR10_BARRACUDA)) {
                            barracudaAmmo += ammoMount.getUsableShotsLeft();
                        } else if (aType.hasFlag(AmmoType.F_AR10_KILLER_WHALE)) {
                            killerwhaleAmmo += ammoMount.getUsableShotsLeft();
                        } else if (aType.hasFlag(AmmoType.F_AR10_WHITE_SHARK)) {
                            whitesharkAmmo += ammoMount.getUsableShotsLeft();
                        }
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            info = "";
            if (barracudaAmmo > 0) {
                info += String.format("[%1$s Barracuda misl]", barracudaAmmo);
            }
            if (killerwhaleAmmo > 0) {
                info += String.format("[%1$s Killer Whale misl]", killerwhaleAmmo);
            }
            if (whitesharkAmmo > 0) {
                info += String.format("[%1$s White Shark misl]", whitesharkAmmo);
            }
        } else if (weapon.getAmmoType() == AmmoType.T_MML) {
            int lrmAmmo = 0;
            int srmAmmo = 0;
            for (int ammoIndex : bay.getBayAmmo()) {
                Mounted ammoMount = unit.getEquipment(ammoIndex);
                try {
                    AmmoType aType = (AmmoType) ammoMount.getType();
                    if ((mount.getLinked() != null) && (aType.getRackSize() == weapon.getRackSize()) && (aType.getAmmoType() == weapon.getAmmoType())) {
                        if (aType.hasFlag(AmmoType.F_MML_LRM)) {
                            lrmAmmo += ammoMount.getUsableShotsLeft();
                        } else {
                            srmAmmo += ammoMount.getUsableShotsLeft();
                        }
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            info = String.format("[%1$s LRM rnds][%2$s SRM rnds]", lrmAmmo, srmAmmo);
        } else {
            int totalAmmo = 0;
            for (int ammoIndex : bay.getBayAmmo()) {
                Mounted ammoMount = unit.getEquipment(ammoIndex);
                try {
                    if ((mount.getLinked() != null) && (ammoMount.getType() == mount.getLinked().getType())) {
                        totalAmmo += ammoMount.getUsableShotsLeft();
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if (weapon instanceof ScreenLauncherWeapon) {
                info = String.format("[%1$s Screens]", totalAmmo);
            } else if (weapon.hasFlag(WeaponType.F_BALLISTIC) || weapon.hasFlag(WeaponType.F_MISSILE) || weapon.hasFlag(WeaponType.F_ARTILLERY) || (weapon.getAtClass() == WeaponType.CLASS_CAPITAL_MISSILE)) {
                info = String.format("[%1$s rnds]", totalAmmo);
            }
        }
    }
    return info;
}
Also used : AmmoType(megamek.common.AmmoType) Mounted(megamek.common.Mounted) WeaponType(megamek.common.WeaponType) ScreenLauncherWeapon(megamek.common.weapons.capitalweapons.ScreenLauncherWeapon)

Example 9 with AmmoType

use of megamek.common.AmmoType in project megameklab by MegaMek.

the class UnitUtil method removeMounted.

public static void removeMounted(Entity unit, Mounted mount) {
    UnitUtil.removeCriticals(unit, mount);
    // Some special checks for BA
    if (unit instanceof BattleArmor) {
        // to detach the weapon
        if (mount.getType().hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK) && (mount.getLinked() != null)) {
            Mounted link = mount.getLinked();
            link.setDWPMounted(false);
            link.setLinked(null);
            link.setLinkedBy(null);
        }
        // to clear the mounted status of the DWP
        if ((mount.getLinkedBy() != null) && mount.getLinkedBy().getType().hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK)) {
            Mounted dwp = mount.getLinkedBy();
            dwp.setLinked(null);
            dwp.setLinkedBy(null);
        }
        // to detach the weapon
        if (mount.getType().hasFlag(MiscType.F_AP_MOUNT) && (mount.getLinked() != null)) {
            Mounted link = mount.getLinked();
            link.setAPMMounted(false);
            link.setLinked(null);
            link.setLinkedBy(null);
        }
        // to clear the mounted status of the AP Mount
        if ((mount.getLinkedBy() != null) && mount.getLinkedBy().getType().hasFlag(MiscType.F_AP_MOUNT)) {
            Mounted apm = mount.getLinkedBy();
            apm.setLinked(null);
            apm.setLinkedBy(null);
        }
    }
    // Some special checks for Aeros
    if (unit instanceof Aero) {
        if (mount.getType() instanceof WeaponType) {
            // Aeros have additional weapon lists that need to be cleared
            ((Aero) unit).getTotalWeaponList().remove(mount);
            ((Aero) unit).getWeaponBayList().remove(mount);
            ((Aero) unit).getWeaponGroupList().remove(mount);
        }
    }
    // We will need to reset the equipment numbers of the bay ammo and weapons
    Map<Mounted, List<Mounted>> bayWeapons = new HashMap<>();
    Map<Mounted, List<Mounted>> bayAmmo = new HashMap<>();
    for (Mounted bay : unit.getWeaponBayList()) {
        List<Mounted> list = bay.getBayWeapons().stream().map(n -> unit.getEquipment(n)).collect(Collectors.toList());
        bayWeapons.put(bay, list);
        list = bay.getBayAmmo().stream().map(n -> unit.getEquipment(n)).collect(Collectors.toList());
        bayAmmo.put(bay, list);
    }
    unit.getEquipment().remove(mount);
    if (mount.getType() instanceof MiscType) {
        unit.getMisc().remove(mount);
    } else if (mount.getType() instanceof AmmoType) {
        unit.getAmmo().remove(mount);
    } else {
        unit.getWeaponList().remove(mount);
        unit.getTotalWeaponList().remove(mount);
    }
    for (Mounted bay : bayWeapons.keySet()) {
        bay.getBayWeapons().clear();
        for (Mounted w : bayWeapons.get(bay)) {
            if (mount != w) {
                bay.getBayWeapons().add(unit.getEquipmentNum(w));
            }
        }
    }
    for (Mounted bay : bayAmmo.keySet()) {
        bay.getBayAmmo().clear();
        for (Mounted a : bayAmmo.get(bay)) {
            if (mount != a) {
                bay.getBayAmmo().add(unit.getEquipmentNum(a));
            }
        }
    }
    // An example of this would be removing a linked Artemis IV FCS
    for (Mounted m : unit.getEquipment()) {
        if (mount.equals(m.getLinkedBy())) {
            m.setLinkedBy(null);
        }
    }
}
Also used : CapitalMissileWeapon(megamek.common.weapons.capitalweapons.CapitalMissileWeapon) Arrays(java.util.Arrays) Dropship(megamek.common.Dropship) RLWeapon(megamek.common.weapons.missiles.RLWeapon) CriticalSlot(megamek.common.CriticalSlot) TestTank(megamek.common.verifier.TestTank) StopSwarmAttack(megamek.common.weapons.StopSwarmAttack) Vector(java.util.Vector) BattleArmor(megamek.common.BattleArmor) HVACWeapon(megamek.common.weapons.autocannons.HVACWeapon) Map(java.util.Map) SRTWeapon(megamek.common.weapons.srms.SRTWeapon) BigInteger(java.math.BigInteger) SmallCraft(megamek.common.SmallCraft) AmmoWeapon(megamek.common.weapons.AmmoWeapon) JFrame(javax.swing.JFrame) Infantry(megamek.common.Infantry) LegAttack(megamek.common.weapons.LegAttack) StreakLRMWeapon(megamek.common.weapons.lrms.StreakLRMWeapon) EnergyWeapon(megamek.common.weapons.lasers.EnergyWeapon) Mech(megamek.common.Mech) GaussWeapon(megamek.common.weapons.gaussrifles.GaussWeapon) VTOL(megamek.common.VTOL) ISAPDS(megamek.common.weapons.other.ISAPDS) Protomech(megamek.common.Protomech) WeaponType(megamek.common.WeaponType) MPodWeapon(megamek.common.weapons.defensivepods.MPodWeapon) Tank(megamek.common.Tank) Entity(megamek.common.Entity) ISC3M(megamek.common.weapons.other.ISC3M) HAGWeapon(megamek.common.weapons.gaussrifles.HAGWeapon) LogLevel(megamek.common.logging.LogLevel) ThunderBoltWeapon(megamek.common.weapons.missiles.ThunderBoltWeapon) VehicleFlamerWeapon(megamek.common.weapons.flamers.VehicleFlamerWeapon) ArrayList(java.util.ArrayList) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) EquipmentType(megamek.common.EquipmentType) MegaMekLab(megameklab.com.MegaMekLab) JEditorPane(javax.swing.JEditorPane) JTextPane(javax.swing.JTextPane) ITechManager(megamek.common.ITechManager) TechConstants(megamek.common.TechConstants) TestMech(megamek.common.verifier.TestMech) Nullable(megamek.common.annotations.Nullable) ISC3MBS(megamek.common.weapons.other.ISC3MBS) SwarmAttack(megamek.common.weapons.SwarmAttack) File(java.io.File) JScrollPane(javax.swing.JScrollPane) PPCWeapon(megamek.common.weapons.ppc.PPCWeapon) EntityVerifier(megamek.common.verifier.EntityVerifier) JDialog(javax.swing.JDialog) DecimalFormatSymbols(java.text.DecimalFormatSymbols) Aero(megamek.common.Aero) ISAMS(megamek.common.weapons.other.ISAMS) EntityWeightClass(megamek.common.EntityWeightClass) ISTAG(megamek.common.weapons.tag.ISTAG) ISLaserAMS(megamek.common.weapons.other.ISLaserAMS) ISBALightTAG(megamek.common.weapons.battlearmor.ISBALightTAG) CLLightTAG(megamek.common.weapons.tag.CLLightTAG) TestEntity(megamek.common.verifier.TestEntity) StreakSRMWeapon(megamek.common.weapons.srms.StreakSRMWeapon) Bay(megamek.common.Bay) TestAero(megamek.common.verifier.TestAero) TestBattleArmor(megamek.common.verifier.TestBattleArmor) SwarmWeaponAttack(megamek.common.weapons.SwarmWeaponAttack) CLBALightTAG(megamek.common.weapons.battlearmor.CLBALightTAG) ScrollPaneConstants(javax.swing.ScrollPaneConstants) LocationFullException(megamek.common.LocationFullException) Font(java.awt.Font) MRMWeapon(megamek.common.weapons.missiles.MRMWeapon) TestInfantry(megamek.common.verifier.TestInfantry) BPodWeapon(megamek.common.weapons.defensivepods.BPodWeapon) TestSmallCraft(megamek.common.verifier.TestSmallCraft) Collectors(java.util.stream.Collectors) LBXACWeapon(megamek.common.weapons.autocannons.LBXACWeapon) Dimension(java.awt.Dimension) List(java.util.List) MiscType(megamek.common.MiscType) TripodMech(megamek.common.TripodMech) Optional(java.util.Optional) UACWeapon(megamek.common.weapons.autocannons.UACWeapon) SRMWeapon(megamek.common.weapons.srms.SRMWeapon) CLBALBX(megamek.common.weapons.battlearmor.CLBALBX) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) CLChemicalLaserWeapon(megamek.common.weapons.lasers.CLChemicalLaserWeapon) CLTAG(megamek.common.weapons.tag.CLTAG) ISPlasmaRifle(megamek.common.weapons.ppc.ISPlasmaRifle) TestSupportVehicle(megamek.common.verifier.TestSupportVehicle) InfantryRifleAutoRifleWeapon(megamek.common.weapons.infantry.InfantryRifleAutoRifleWeapon) MGWeapon(megamek.common.weapons.mgs.MGWeapon) HashMap(java.util.HashMap) CLAMS(megamek.common.weapons.other.CLAMS) CLLaserAMS(megamek.common.weapons.other.CLLaserAMS) Graphics2D(java.awt.Graphics2D) BipedMech(megamek.common.BipedMech) Mounted(megamek.common.Mounted) MechView(megamek.common.MechView) AmmoType(megamek.common.AmmoType) ITechnology(megamek.common.ITechnology) CLPlasmaCannon(megamek.common.weapons.ppc.CLPlasmaCannon) LRTWeapon(megamek.common.weapons.lrms.LRTWeapon) DecimalFormat(java.text.DecimalFormat) LRMWeapon(megamek.common.weapons.lrms.LRMWeapon) FileInputStream(java.io.FileInputStream) LandAirMech(megamek.common.LandAirMech) JOptionPane(javax.swing.JOptionPane) InfantryWeapon(megamek.common.weapons.infantry.InfantryWeapon) ACWeapon(megamek.common.weapons.autocannons.ACWeapon) MMLogger(megamek.common.logging.MMLogger) DefaultCaret(javax.swing.text.DefaultCaret) QuadMech(megamek.common.QuadMech) InputStream(java.io.InputStream) AmmoType(megamek.common.AmmoType) HashMap(java.util.HashMap) Mounted(megamek.common.Mounted) WeaponType(megamek.common.WeaponType) MiscType(megamek.common.MiscType) ArrayList(java.util.ArrayList) List(java.util.List) Aero(megamek.common.Aero) TestAero(megamek.common.verifier.TestAero) BattleArmor(megamek.common.BattleArmor) TestBattleArmor(megamek.common.verifier.TestBattleArmor)

Example 10 with AmmoType

use of megamek.common.AmmoType in project megameklab by MegaMek.

the class CritListCellRenderer method getListCellRendererComponent.

@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean hasFocus) {
    JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus);
    this.list = list;
    setPreferredSize(new Dimension(110, 15));
    setMaximumSize(new Dimension(110, 15));
    setMinimumSize(new Dimension(110, 15));
    String[] split = ((String) value).split(":");
    label.setText(split[0]);
    CriticalSlot cs;
    if (split.length > 2) {
        int eqId = Integer.parseInt(split[2]);
        cs = new CriticalSlot(unit.getEquipment(eqId));
    } else if (split.length > 1) {
        cs = getCrit(Integer.parseInt(split[1]));
    } else if (((String) value).equals("-Empty-")) {
        cs = null;
    } else {
        cs = getCrit(index);
    }
    if (cs != null) {
        if (cs.getType() == CriticalSlot.TYPE_SYSTEM) {
            if (useColor) {
                label.setBackground(CConfig.getBackgroundColor(CConfig.CONFIG_SYSTEMS));
                label.setForeground(CConfig.getForegroundColor(CConfig.CONFIG_SYSTEMS));
            }
            if (cs.isArmored()) {
                label.setText(label.getText() + " (A)");
            }
        } else if (cs.getMount() != null) {
            Mounted mount = cs.getMount();
            if (useColor) {
                if (mount.getType() instanceof WeaponType) {
                    label.setBackground(CConfig.getBackgroundColor(CConfig.CONFIG_WEAPONS));
                    label.setForeground(CConfig.getForegroundColor(CConfig.CONFIG_WEAPONS));
                } else if (mount.getType() instanceof AmmoType) {
                    label.setBackground(CConfig.getBackgroundColor(CConfig.CONFIG_AMMO));
                    label.setForeground(CConfig.getForegroundColor(CConfig.CONFIG_AMMO));
                } else {
                    label.setBackground(CConfig.getBackgroundColor(CConfig.CONFIG_EQUIPMENT));
                    label.setForeground(CConfig.getForegroundColor(CConfig.CONFIG_EQUIPMENT));
                }
            }
            String name = UnitUtil.getCritName(unit, mount.getType());
            if (mount.isRearMounted()) {
                name += " (R)";
            }
            if (mount.isArmored()) {
                name += " (A)";
            }
            if (mount.isMechTurretMounted()) {
                name += " (T)";
            }
            if (mount.isSponsonTurretMounted()) {
                name += " (ST)";
            }
            if (mount.isPintleTurretMounted()) {
                name += " (PT)";
            }
            if (mount.isDWPMounted()) {
                name += " (DWP)";
            }
            if (unit.isOmni() && !mount.getType().isOmniFixedOnly()) {
                if (mount.isOmniPodMounted()) {
                    name += " (Pod)";
                } else {
                    name += " (Fixed)";
                    label.setFont(label.getFont().deriveFont(Font.ITALIC));
                }
            }
            if ((mount.getType().hasFlag(MiscType.F_DETACHABLE_WEAPON_PACK) || mount.getType().hasFlag(MiscType.F_AP_MOUNT)) && mount.getLinked() != null) {
                name += " (attached " + mount.getLinked().getName() + ")";
            }
            // many shots are in this Critical
            if ((unit instanceof BattleArmor) && (mount.getType() instanceof AmmoType)) {
                name += " (" + mount.getBaseShotsLeft() + ")";
            }
            String toolTipText = UnitUtil.getToolTipInfo(unit, mount);
            if (cs.getMount2() != null) {
                mount = cs.getMount2();
                name += " | " + UnitUtil.getCritName(unit, mount.getType());
            }
            label.setText(name);
            label.setToolTipText(toolTipText);
        }
    } else if (useColor) {
        label.setBackground(CConfig.getBackgroundColor(CConfig.CONFIG_EMPTY));
        label.setForeground(CConfig.getForegroundColor(CConfig.CONFIG_EMPTY));
    }
    int loc = getCritLocation();
    if ((cs != null) && UnitUtil.isLastCrit(unit, cs, index, loc) && UnitUtil.isPreviousCritEmpty(unit, cs, index, loc)) {
        label.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.black));
    } else if ((cs != null) && UnitUtil.isLastCrit(unit, cs, index, loc)) {
        label.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black));
    } else if ((cs != null) && UnitUtil.isPreviousCritEmpty(unit, cs, index, loc)) {
        label.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.black));
    }
    return label;
}
Also used : AmmoType(megamek.common.AmmoType) CriticalSlot(megamek.common.CriticalSlot) Mounted(megamek.common.Mounted) WeaponType(megamek.common.WeaponType) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) BattleArmor(megamek.common.BattleArmor)

Aggregations

AmmoType (megamek.common.AmmoType)34 Mounted (megamek.common.Mounted)32 ArrayList (java.util.ArrayList)15 MiscType (megamek.common.MiscType)15 WeaponType (megamek.common.WeaponType)15 Vector (java.util.Vector)13 Font (java.awt.Font)9 EquipmentType (megamek.common.EquipmentType)8 LocationFullException (megamek.common.LocationFullException)7 BattleArmor (megamek.common.BattleArmor)6 Weapon (megamek.common.weapons.Weapon)6 Dimension (java.awt.Dimension)5 JMenuItem (javax.swing.JMenuItem)5 JPopupMenu (javax.swing.JPopupMenu)5 InfantryWeapon (megamek.common.weapons.infantry.InfantryWeapon)5 PPCWeapon (megamek.common.weapons.ppc.PPCWeapon)5 MouseEvent (java.awt.event.MouseEvent)4 MouseListener (java.awt.event.MouseListener)4 HashMap (java.util.HashMap)4 Hashtable (java.util.Hashtable)4