Search in sources :

Example 1 with AmmoType

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

the class ImageHelperDropShip method printDropshipWeaponsNEquipment.

public static void printDropshipWeaponsNEquipment(Dropship dropship, Graphics2D g2d) {
    int qtyPoint = 26;
    int typePoint = 38;
    int locPoint = 111;
    int heatPoint = 135;
    int shtPoint = 151;
    int medPoint = 169;
    int longPoint = 192;
    int erPoint = 211;
    int nameSize = 65;
    float linePoint = 210f;
    float lineFeed = 6.7f;
    float maxHeight = 140f;
    float stringHeight = 0;
    float fontSize = 7.0f;
    boolean newLineNeeded = false;
    boolean hasCapital = false;
    boolean hasSubCapital = false;
    String[] locAbbr = dropship.isSpheroid() ? LOCATION_ABBRS_SPHEROID : LOCATION_ABBRS_AERODYNE;
    ArrayList<Vector<EquipmentInfo>> equipmentLocations = new ArrayList<Vector<EquipmentInfo>>(locAbbr.length);
    ArrayList<Vector<EquipmentInfo>> capitalEquipmentLocations = new ArrayList<Vector<EquipmentInfo>>(locAbbr.length);
    if (dropship.getMovementMode() == EntityMovementMode.AERODYNE) {
        linePoint = 201;
    }
    for (int pos = 0; pos < locAbbr.length; pos++) {
        equipmentLocations.add(pos, new Vector<EquipmentInfo>());
        capitalEquipmentLocations.add(pos, new Vector<EquipmentInfo>());
    }
    for (Mounted eq : dropship.getWeaponBayList()) {
        if ((eq.isWeaponGroup() || (eq.getType() instanceof AmmoType)) || (eq.getLocation() == Entity.LOC_NONE) || !UnitUtil.isPrintableEquipment(eq.getType())) {
            continue;
        }
        Vector<EquipmentInfo> eqHash = equipmentLocations.get(eq.getLocation());
        Vector<EquipmentInfo> capitalEqHash = capitalEquipmentLocations.get(eq.getLocation());
        String equipmentName = "";
        if (eq.isRearMounted()) {
            switch(eq.getLocation()) {
                case Aero.LOC_LWING:
                    eqHash = equipmentLocations.get(ImageHelperDropShip.LOC_AL);
                    capitalEqHash = capitalEquipmentLocations.get(ImageHelperDropShip.LOC_AL);
                    break;
                case Aero.LOC_RWING:
                    eqHash = equipmentLocations.get(ImageHelperDropShip.LOC_AR);
                    capitalEqHash = capitalEquipmentLocations.get(ImageHelperDropShip.LOC_AR);
                    break;
            }
        }
        if ((eq.getType() instanceof BayWeapon) && ((BayWeapon) eq.getType()).isCapital()) {
            EquipmentInfo eqi = null;
            for (int weaponIndex : eq.getBayWeapons()) {
                Mounted weapon = dropship.getEquipment(weaponIndex);
                if ((eqi == null) || (equipmentName == "") || !equipmentName.equalsIgnoreCase(UnitUtil.getCritName(dropship, weapon.getType())) || (weapon.getType().getTechLevel(dropship.getTechLevelYear()) != eqi.techLevel)) {
                    if (eqi != null) {
                        eqi = new EquipmentInfo(dropship, weapon, eq);
                        equipmentName = eqi.name;
                        eqi.shouldIndent = true;
                        capitalEqHash.add(eqi);
                    } else {
                        eqi = new EquipmentInfo(dropship, weapon, eq);
                        capitalEqHash.add(eqi);
                        equipmentName = eqi.name;
                    }
                } else {
                    eqi.count++;
                }
            }
        } else {
            EquipmentInfo eqi = null;
            for (int weaponIndex : eq.getBayWeapons()) {
                Mounted weapon = dropship.getEquipment(weaponIndex);
                if ((eqi == null) || (equipmentName == "") || !equipmentName.equalsIgnoreCase((UnitUtil.getCritName(dropship, weapon.getType()))) || (weapon.getType().getTechLevel(dropship.getTechLevelYear()) != eqi.techLevel)) {
                    if (eqi != null) {
                        eqi = new EquipmentInfo(dropship, weapon, eq);
                        eqi.shouldIndent = true;
                        eqHash.add(eqi);
                        equipmentName = eqi.name;
                    } else {
                        eqi = new EquipmentInfo(dropship, weapon, eq);
                        eqHash.add(eqi);
                        equipmentName = eqi.name;
                    }
                } else {
                    eqi.count++;
                }
            }
        }
    }
    equipmentLocations.get(ImageHelperDropShip.LOC_FL_FR).addAll(equipmentLocations.get(Aero.LOC_LWING));
    equipmentLocations.get(Aero.LOC_LWING).clear();
    equipmentLocations.get(Aero.LOC_RWING).clear();
    equipmentLocations.get(ImageHelperDropShip.LOC_AL_AR).addAll(equipmentLocations.get(ImageHelperDropShip.LOC_AL));
    equipmentLocations.get(ImageHelperDropShip.LOC_AL).clear();
    equipmentLocations.get(ImageHelperDropShip.LOC_AR).clear();
    capitalEquipmentLocations.get(ImageHelperDropShip.LOC_FL_FR).addAll(capitalEquipmentLocations.get(Aero.LOC_LWING));
    capitalEquipmentLocations.get(Aero.LOC_LWING).clear();
    capitalEquipmentLocations.get(Aero.LOC_RWING).clear();
    capitalEquipmentLocations.get(ImageHelperDropShip.LOC_AL_AR).addAll(capitalEquipmentLocations.get(ImageHelperDropShip.LOC_AL));
    capitalEquipmentLocations.get(ImageHelperDropShip.LOC_AL).clear();
    capitalEquipmentLocations.get(ImageHelperDropShip.LOC_AR).clear();
    Font font = ImageHelperDropShip.getDropShipWeaponsNEquipmentFont(g2d, true, maxHeight, equipmentLocations, capitalEquipmentLocations, fontSize);
    g2d.setFont(font);
    fontSize = font.getSize2D();
    stringHeight = ImageHelper.getStringHeight(g2d, "H", font);
    lineFeed = stringHeight;
    for (int pos = 0; pos < LOCATION_PRINT.length; pos++) {
        Vector<EquipmentInfo> eqHash = capitalEquipmentLocations.get(LOCATION_PRINT[pos]);
        if (eqHash.isEmpty()) {
            continue;
        }
        // damage has to be combined for all stuff in a bay
        for (int i = 0; i < eqHash.size(); i++) {
            EquipmentInfo eqi = eqHash.get(i);
            if (!eqi.shouldIndent) {
                // first, calculate the damage values here, so we can add
                // other
                // weapons in the same bay in the next step
                eqi.heat *= eqi.count;
                if (eqi.shtRange > 0) {
                    eqi.shtRange *= eqi.count;
                }
                if (eqi.medRange > 0) {
                    eqi.medRange *= eqi.count;
                }
                if (eqi.longRange > 0) {
                    eqi.longRange *= eqi.count;
                }
                if (eqi.erRange > 0) {
                    eqi.erRange *= eqi.count;
                }
                // shouldIndent and as such belong in the same bay
                for (int j = i + 1; j < eqHash.size(); j++) {
                    EquipmentInfo eqiBay = eqHash.get(j);
                    if (eqiBay.shouldIndent) {
                        eqi.heat += (eqiBay.heat * eqiBay.count);
                        eqiBay.heat = -1;
                        if (eqiBay.shtRange > 0) {
                            eqi.shtRange += (eqiBay.shtRange * eqiBay.count);
                        }
                        if (eqiBay.medRange > 0) {
                            eqi.medRange += (eqiBay.medRange * eqiBay.count);
                        }
                        if (eqiBay.longRange > 0) {
                            eqi.longRange += (eqiBay.longRange * eqiBay.count);
                        }
                        if (eqiBay.erRange > 0) {
                            eqi.erRange += (eqiBay.erRange * eqiBay.count);
                        }
                        eqiBay.shtRange = -1;
                        eqiBay.medRange = -1;
                        eqiBay.longRange = -1;
                        eqiBay.erRange = -1;
                        i++;
                    } else {
                        break;
                    }
                }
            }
        }
        if (!hasCapital) {
            hasCapital = true;
            g2d.drawString("Capital Scale", typePoint, linePoint);
            font = UnitUtil.getNewFont(g2d, "(1-12) (13-24) (25-40) (41-50)", true, 75, fontSize);
            g2d.setFont(font);
            g2d.drawString("(1-12) (13-24) (25-40) (41-50)", shtPoint, linePoint);
            linePoint += lineFeed;
            font = UnitUtil.getNewFont(g2d, "Bay", true, 68, fontSize);
            g2d.setFont(font);
            g2d.drawString("Bay", typePoint, linePoint);
            g2d.drawString("Loc", locPoint, linePoint);
            g2d.drawString("Ht", heatPoint, linePoint);
            g2d.drawString("SRV", shtPoint, linePoint);
            g2d.drawString("MRV", medPoint, linePoint);
            g2d.drawString("LRV", longPoint, linePoint);
            g2d.drawString("ERV", erPoint, linePoint);
            linePoint += lineFeed;
        }
        for (EquipmentInfo eqi : eqHash) {
            newLineNeeded = false;
            if (eqi.shouldIndent) {
                qtyPoint += 5;
                typePoint += 5;
                nameSize -= 10;
            }
            font = UnitUtil.deriveFont(false, fontSize);
            g2d.setFont(font);
            g2d.drawString(Integer.toString(eqi.count), qtyPoint, linePoint);
            String name = eqi.name.trim();
            if (eqi.hasArtemis) {
                name = name + " w/Artemis IV FCS";
            } else if (eqi.hasArtemisV) {
                name = name + " w/Artemis V FCS";
            } else if (eqi.hasApollo) {
                name = name + " w/Apollo FCS";
            }
            font = UnitUtil.getNewFont(g2d, name, false, nameSize, fontSize);
            g2d.setFont(font);
            if (eqi.c3Level == EquipmentInfo.C3I) {
                ImageHelper.printNavalC3Name(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3EM) {
                ImageHelper.printC3EmName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3S) {
                ImageHelper.printC3sName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3M) {
                ImageHelper.printC3mName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3SB) {
                ImageHelper.printC3sbName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3MB) {
                ImageHelper.printC3mbName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3REMOTESENSOR) {
                ImageHelper.printC3RemoteSensorName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.isMashCore) {
                ImageHelper.printMashCore(g2d, typePoint, linePoint, font, false, dropship);
            } else if (eqi.isDroneControl) {
                ImageHelper.printDroneControl(g2d, typePoint, linePoint, font, false, dropship);
            } else {
                g2d.drawString(name, typePoint, linePoint);
                if ((eqi.damage.trim().length() > 0) && !eqi.isAR10) {
                    g2d.drawString(eqi.damage, typePoint, linePoint + lineFeed);
                    newLineNeeded = true;
                }
            }
            if (eqi.shouldIndent) {
                qtyPoint -= 5;
                typePoint -= 5;
                nameSize += 10;
            }
            String location = locAbbr[LOCATION_PRINT[pos]];
            ImageHelper.printCenterString(g2d, location, font, locPoint + 5, linePoint);
            if ((eqi.heat != -1) && !eqi.isAR10) {
                ImageHelper.printCenterString(g2d, Integer.toString(eqi.heat), font, heatPoint + 4, linePoint);
            }
            font = UnitUtil.deriveFont(Math.min(6f, fontSize));
            g2d.setFont(font);
            if (eqi.isAR10) {
                int ammoLines = StringUtils.countOccurrences(eqi.damage, '[');
                String ammoString = eqi.damage;
                for (int i = 0; i < ammoLines; i++) {
                    String printString = ammoString.substring(0, ammoString.indexOf("]") + 1);
                    ammoString = ammoString.substring(ammoString.indexOf("]") + 1);
                    linePoint += lineFeed;
                    g2d.drawString(printString, typePoint, linePoint);
                    String damage = "";
                    if (printString.indexOf("Barracuda") != -1) {
                        ImageHelper.printCenterString(g2d, Integer.toString(10 * eqi.count), font, heatPoint + 4, linePoint);
                        int baseDam = 2 * eqi.count;
                        int baseDamNormalScale = 20 * eqi.count;
                        if (baseDamNormalScale < 100) {
                            damage = baseDam + " (" + baseDamNormalScale + ")";
                        } else {
                            damage = Integer.toString(baseDam);
                        }
                    } else if (printString.indexOf("White Shark") != -1) {
                        ImageHelper.printCenterString(g2d, Integer.toString(15 * eqi.count), font, heatPoint + 4, linePoint);
                        int baseDam = 3 * eqi.count;
                        int baseDamNormalScale = 30 * eqi.count;
                        if (baseDamNormalScale < 100) {
                            damage = baseDam + " (" + baseDamNormalScale + ")";
                        } else {
                            damage = Integer.toString(baseDam);
                        }
                    } else if (printString.indexOf("Killer Whale") != -1) {
                        ImageHelper.printCenterString(g2d, Integer.toString(20 * eqi.count), font, heatPoint + 4, linePoint);
                        int baseDam = 4 * eqi.count;
                        int baseDamNormalScale = 40 * eqi.count;
                        if (baseDamNormalScale < 100) {
                            damage = baseDam + " (" + baseDamNormalScale + ")";
                        } else {
                            damage = Integer.toString(baseDam);
                        }
                    }
                    g2d.drawString(damage, shtPoint, linePoint);
                    g2d.drawString(damage, medPoint, linePoint);
                    g2d.drawString(damage, longPoint, linePoint);
                    g2d.drawString(damage, erPoint, linePoint);
                }
            } else if (eqi.shtRange > 0) {
                if ((eqi.shtRange * 10) < 100) {
                    g2d.drawString(String.format("%1$d (%2$d)", eqi.shtRange, eqi.shtRange * 10), shtPoint, linePoint);
                } else {
                    g2d.drawString(String.format("%1$d", eqi.shtRange), shtPoint, linePoint);
                }
                if (eqi.medRange > 0) {
                    if ((eqi.medRange * 10) < 100) {
                        g2d.drawString(String.format("%1$d (%2$d)", eqi.medRange, eqi.medRange * 10), medPoint, linePoint);
                    } else {
                        g2d.drawString(String.format("%1$d", eqi.medRange), medPoint, linePoint);
                    }
                } else if (eqi.medRange != -1) {
                    g2d.drawString("\u2014", medPoint, linePoint);
                }
                if (eqi.longRange > 0) {
                    if ((eqi.longRange * 10) < 100) {
                        g2d.drawString(String.format("%1$d (%2$d)", eqi.longRange, eqi.longRange * 10), longPoint, linePoint);
                    } else {
                        g2d.drawString(String.format("%1$d", eqi.longRange), longPoint, linePoint);
                    }
                } else if (eqi.longRange != -1) {
                    g2d.drawString("\u2014", longPoint, linePoint);
                }
                if (eqi.erRange > 0) {
                    if ((eqi.erRange * 10) < 100) {
                        g2d.drawString(String.format("%1$d (%2$d)", eqi.erRange, eqi.erRange * 10), erPoint, linePoint);
                    } else {
                        g2d.drawString(String.format("%1$d", eqi.erRange), erPoint, linePoint);
                    }
                } else if (eqi.erRange != -1) {
                    g2d.drawString("\u2014", erPoint, linePoint);
                }
            } else if (eqi.shtRange != -1) {
                g2d.drawString("\u2014", shtPoint, linePoint);
            } else if (eqi.isAMS) {
                g2d.drawString("Point Defense", medPoint, linePoint);
            }
            linePoint += lineFeed;
            if (newLineNeeded) {
                linePoint += lineFeed;
            }
        }
    }
    g2d.setFont(UnitUtil.deriveFont(true, g2d.getFont().getSize2D()));
    for (int pos = 0; pos < LOCATION_PRINT.length; pos++) {
        Vector<EquipmentInfo> eqHash = equipmentLocations.get(LOCATION_PRINT[pos]);
        if (eqHash.isEmpty()) {
            continue;
        }
        // damage has to be combined for all stuff in a bay
        for (int i = 0; i < eqHash.size(); i++) {
            EquipmentInfo eqi = eqHash.get(i);
            if (!eqi.shouldIndent) {
                // first, calculate the damage values here, so we can add
                // other
                // weapons in the same bay in the next step
                eqi.heat *= eqi.count;
                if (eqi.shtRange > 0) {
                    eqi.shtRange *= eqi.count;
                }
                if (eqi.medRange > 0) {
                    eqi.medRange *= eqi.count;
                }
                if (eqi.longRange > 0) {
                    eqi.longRange *= eqi.count;
                }
                if (eqi.erRange > 0) {
                    eqi.erRange *= eqi.count;
                }
                // shouldIndent and as such belong in the same bay
                for (int j = i + 1; j < eqHash.size(); j++) {
                    EquipmentInfo eqiBay = eqHash.get(j);
                    if (eqiBay.shouldIndent) {
                        eqi.heat += eqiBay.heat * eqiBay.count;
                        eqiBay.heat = -1;
                        if (eqiBay.shtRange > 0) {
                            eqi.shtRange += eqiBay.shtRange * eqiBay.count;
                        }
                        if (eqiBay.medRange > 0) {
                            eqi.medRange += eqiBay.medRange * eqiBay.count;
                        }
                        if (eqiBay.longRange > 0) {
                            eqi.longRange += eqiBay.longRange * eqiBay.count;
                        }
                        if (eqiBay.erRange > 0) {
                            eqi.erRange += eqiBay.erRange * eqiBay.count;
                        }
                        eqiBay.shtRange = -1;
                        eqiBay.medRange = -1;
                        eqiBay.longRange = -1;
                        eqiBay.erRange = -1;
                        i++;
                    } else {
                        break;
                    }
                }
            }
        }
        if (!hasSubCapital) {
            hasSubCapital = true;
            g2d.drawString("Standard Scale", typePoint, linePoint);
            font = UnitUtil.getNewFont(g2d, "(1-6) (7-12) (13-20) (21-25)", true, 75, fontSize);
            g2d.setFont(font);
            g2d.drawString("(1-6) (7-12) (13-20) (21-25)", shtPoint, linePoint);
            linePoint += lineFeed;
            font = UnitUtil.getNewFont(g2d, "Bay", true, 68, fontSize);
            g2d.setFont(font);
            g2d.drawString("Bay", typePoint, linePoint);
            g2d.drawString("Loc", locPoint, linePoint);
            g2d.drawString("Ht", heatPoint, linePoint);
            g2d.drawString("SRV", shtPoint, linePoint);
            g2d.drawString("MRV", medPoint, linePoint);
            g2d.drawString("LRV", longPoint, linePoint);
            g2d.drawString("ERV", erPoint, linePoint);
            linePoint += lineFeed;
        }
        for (EquipmentInfo eqi : eqHash) {
            newLineNeeded = false;
            if (eqi.shouldIndent) {
                qtyPoint += 5;
                typePoint += 5;
                nameSize -= 10;
            }
            font = UnitUtil.deriveFont(false, fontSize);
            g2d.setFont(font);
            g2d.drawString(Integer.toString(eqi.count), qtyPoint, linePoint);
            String name = eqi.name.trim();
            if (eqi.hasArtemis) {
                name = name + " w/Artemis IV FCS";
            } else if (eqi.hasArtemisV) {
                name = name + " w/Artemis V FCS";
            } else if (eqi.hasApollo) {
                name = name + " w/Apollo FCS";
            }
            font = UnitUtil.getNewFont(g2d, name, false, 68, fontSize);
            g2d.setFont(font);
            if (eqi.c3Level == EquipmentInfo.C3I) {
                ImageHelper.printNavalC3Name(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3S) {
                ImageHelper.printC3sName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3M) {
                ImageHelper.printC3mName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3SB) {
                ImageHelper.printC3sbName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3MB) {
                ImageHelper.printC3mbName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3REMOTESENSOR) {
                ImageHelper.printC3RemoteSensorName(g2d, typePoint, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
            } else {
                g2d.drawString(name, typePoint, linePoint);
                if ((eqi.damage.trim().length() > 0) && !eqi.isMML) {
                    g2d.drawString(eqi.damage, typePoint, linePoint + lineFeed);
                    newLineNeeded = true;
                }
            }
            if (eqi.shouldIndent) {
                qtyPoint -= 5;
                typePoint -= 5;
                nameSize += 10;
            }
            String location = locAbbr[LOCATION_PRINT[pos]];
            ImageHelper.printCenterString(g2d, location, font, locPoint + 5, linePoint);
            if (eqi.heat != -1) {
                ImageHelper.printCenterString(g2d, Integer.toString(eqi.heat), font, heatPoint + 4, linePoint);
            }
            if (eqi.isMML) {
                String lrmAmmoString = eqi.damage.substring(0, eqi.damage.indexOf("]") + 1);
                String srmAmmoString = eqi.damage.substring(eqi.damage.indexOf("]") + 1);
                linePoint += lineFeed;
                g2d.drawString(srmAmmoString, typePoint, linePoint);
                String damage = String.format("%1$d (%2$d)", Math.round((eqi.shtRange * 2) / 10f), eqi.shtRange * 2);
                font = UnitUtil.getNewFont(g2d, damage, false, 17, fontSize);
                g2d.setFont(font);
                g2d.drawString(damage, shtPoint, linePoint);
                font = UnitUtil.deriveFont(false, fontSize);
                g2d.setFont(font);
                g2d.drawString("\u2014", medPoint, linePoint);
                g2d.drawString("\u2014", longPoint, linePoint);
                g2d.drawString("\u2014", erPoint, linePoint);
                linePoint += lineFeed;
                g2d.drawString(lrmAmmoString, typePoint, linePoint);
                damage = String.format("%1$d (%2$d)", Math.round((eqi.shtRange) / 10f), eqi.shtRange);
                font = UnitUtil.getNewFont(g2d, damage, false, 17, fontSize);
                g2d.setFont(font);
                g2d.drawString(damage, shtPoint, linePoint);
                g2d.drawString(damage, medPoint, linePoint);
                g2d.drawString(damage, longPoint, linePoint);
                g2d.drawString("\u2014", erPoint, linePoint);
                font = UnitUtil.deriveFont(false, fontSize);
                g2d.setFont(font);
            } else if (eqi.shtRange > 0) {
                String damage = String.format("%1$d (%2$d)", Math.round((eqi.shtRange) / 10f), eqi.shtRange);
                font = UnitUtil.getNewFont(g2d, damage, false, 17, fontSize);
                g2d.setFont(font);
                g2d.drawString(damage, shtPoint, linePoint);
                font = UnitUtil.deriveFont(fontSize);
                g2d.setFont(font);
            } else if (eqi.shtRange != -1) {
                g2d.drawString("\u2014", shtPoint, linePoint);
            }
            if (eqi.isAMS) {
                g2d.drawString("Point Defense", medPoint, linePoint);
            } else {
                if ((eqi.medRange > 0) && !eqi.isMML) {
                    String damage = String.format("%1$d (%2$d)", Math.round((eqi.medRange) / 10f), eqi.medRange);
                    font = UnitUtil.getNewFont(g2d, damage, false, 17, fontSize);
                    g2d.setFont(font);
                    g2d.drawString(damage, medPoint, linePoint);
                    font = UnitUtil.deriveFont(fontSize);
                    g2d.setFont(font);
                } else if (!eqi.isMML && (eqi.medRange != -1)) {
                    g2d.drawString("\u2014", medPoint, linePoint);
                }
                if ((eqi.longRange > 0) && !eqi.isMML) {
                    String damage = String.format("%1$d (%2$d)", Math.round((eqi.longRange) / 10f), eqi.longRange);
                    font = UnitUtil.getNewFont(g2d, damage, false, 17, fontSize);
                    g2d.setFont(font);
                    g2d.drawString(damage, longPoint, linePoint);
                    font = UnitUtil.deriveFont(fontSize);
                    g2d.setFont(font);
                } else if (!eqi.isMML && (eqi.longRange != -1)) {
                    g2d.drawString("\u2014", longPoint, linePoint);
                }
                if ((eqi.erRange > 0) && !eqi.isMML) {
                    String damage = String.format("%1$d (%2$d)", Math.round((eqi.erRange) / 10f), eqi.erRange);
                    font = UnitUtil.getNewFont(g2d, damage, false, 17, fontSize);
                    g2d.setFont(font);
                    g2d.drawString(damage, erPoint, linePoint);
                    font = UnitUtil.deriveFont(fontSize);
                    g2d.setFont(font);
                } else if (!eqi.isMML && (eqi.erRange != -1)) {
                    g2d.drawString("\u2014", erPoint, linePoint);
                }
            }
            linePoint += lineFeed;
            if (newLineNeeded && !eqi.isMML) {
                linePoint += lineFeed;
            }
        }
    }
    int pointX = 22;
    boolean notesPrinted = false;
    font = UnitUtil.deriveFont(true, g2d.getFont().getSize2D());
    EquipmentInfo eq = null;
    Vector<EquipmentInfo> eqHash = new Vector<EquipmentInfo>();
    for (Mounted mount : dropship.getEquipment()) {
        if ((mount.getLocation() == Entity.LOC_NONE) && UnitUtil.isPrintableEquipment(mount.getType())) {
            eq = new EquipmentInfo(dropship, mount, null);
            eqHash.add(eq);
        }
    }
    for (EquipmentInfo eqi : eqHash) {
        if (!notesPrinted) {
            g2d.setFont(font);
            g2d.drawString("Notes: ", pointX, linePoint);
            linePoint += lineFeed;
            font = UnitUtil.deriveFont(g2d.getFont().getSize2D());
            notesPrinted = true;
            g2d.setFont(font);
        }
        if (eqi.c3Level == EquipmentInfo.C3I) {
            ImageHelper.printNavalC3Name(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.c3Level == EquipmentInfo.C3EM) {
            ImageHelper.printC3EmName(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.c3Level == EquipmentInfo.C3S) {
            ImageHelper.printC3sName(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.c3Level == EquipmentInfo.C3M) {
            ImageHelper.printC3mName(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.c3Level == EquipmentInfo.C3SB) {
            ImageHelper.printC3sbName(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.c3Level == EquipmentInfo.C3MB) {
            ImageHelper.printC3mbName(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.c3Level == EquipmentInfo.C3REMOTESENSOR) {
            ImageHelper.printC3RemoteSensorName(g2d, pointX, linePoint, font, false, dropship.isMixedTech() && TechConstants.isClan(dropship.getTechLevel()));
        } else if (eqi.isMashCore) {
            ImageHelper.printMashCore(g2d, pointX, linePoint, font, false, dropship);
        } else if (eqi.isDroneControl) {
            ImageHelper.printDroneControl(g2d, pointX, linePoint, font, false, dropship);
        } else {
            g2d.drawString(eqi.name, pointX, linePoint);
        }
        linePoint += lineFeed;
    }
    ImageHelperDropShip.printDropShipCargo(dropship, g2d, linePoint);
}
Also used : ArrayList(java.util.ArrayList) BayWeapon(megamek.common.weapons.bayweapons.BayWeapon) Font(java.awt.Font) AmmoType(megamek.common.AmmoType) Mounted(megamek.common.Mounted) Vector(java.util.Vector)

Example 2 with AmmoType

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

the class ImageHelperProto method printProtomechWeaponsNEquipment.

public static void printProtomechWeaponsNEquipment(Protomech proto, Graphics2D g2d, float offset) {
    int locationPoint = 124;
    int typePoint = 151;
    int damagePoint = 224;
    int minPoint = 242;
    int shtPoint = 260;
    int medPoint = 274;
    int longPoint = 290;
    float linePoint = 116f + offset;
    boolean torsoWeaponUsed = false;
    float lineFeed = 6.2f;
    boolean newLineNeeded = false;
    ArrayList<Vector<EquipmentInfo>> equipmentLocations = new ArrayList<Vector<EquipmentInfo>>(Protomech.LOC_MAINGUN + 1);
    for (int pos = 0; pos <= Protomech.LOC_MAINGUN; pos++) {
        equipmentLocations.add(pos, new Vector<EquipmentInfo>());
    }
    for (Mounted eq : proto.getEquipment()) {
        if ((eq.getType() instanceof AmmoType) || (eq.getLocation() == Entity.LOC_NONE) || !UnitUtil.isPrintableEquipment(eq.getType())) {
            continue;
        }
        Vector<EquipmentInfo> eqHash = equipmentLocations.get(eq.getLocation());
        String equipmentName = eq.getName();
        if (eq.isRearMounted()) {
            equipmentName += "(R)";
        }
        EquipmentInfo eqi = new EquipmentInfo(proto, eq);
        eqi.name = equipmentName;
        eqHash.add(eqi);
    }
    Font font = UnitUtil.deriveFont(true, 10.0f);
    g2d.setFont(font);
    for (int pos = Protomech.LOC_HEAD; pos <= Protomech.LOC_MAINGUN; pos++) {
        Vector<EquipmentInfo> eqVector = equipmentLocations.get(pos);
        if (eqVector.size() < 1) {
            continue;
        }
        int count = 0;
        ArrayList<EquipmentInfo> equipmentList = new ArrayList<EquipmentInfo>();
        for (EquipmentInfo eqi : eqVector) {
            equipmentList.add(eqi);
        }
        Collections.sort(equipmentList, StringUtils.equipmentInfoComparator());
        for (EquipmentInfo eqi : equipmentList) {
            newLineNeeded = false;
            if (count >= 12) {
                break;
            }
            font = UnitUtil.deriveFont(5.0f);
            g2d.setFont(font);
            if ((pos == Protomech.LOC_TORSO) && !torsoWeaponUsed) {
                g2d.drawString(String.format("%1$9s A:", proto.getLocationName(pos)), locationPoint, linePoint);
                torsoWeaponUsed = true;
            } else if ((pos == Protomech.LOC_TORSO) && torsoWeaponUsed) {
                g2d.drawString(String.format("%1$9s B:", proto.getLocationName(pos)), locationPoint, linePoint);
            } else {
                g2d.drawString(String.format("%1$9s:", proto.getLocationName(pos)), locationPoint, linePoint);
            }
            String name = eqi.name.trim();
            g2d.setFont(UnitUtil.getNewFont(g2d, name, false, 68, 7.0f));
            if (eqi.c3Level == EquipmentInfo.C3I) {
                ImageHelper.printC3iName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3EM) {
                ImageHelper.printC3EmName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3S) {
                ImageHelper.printC3sName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3M) {
                ImageHelper.printC3mName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3SB) {
                ImageHelper.printC3sbName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3MB) {
                ImageHelper.printC3mbName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else if (eqi.c3Level == EquipmentInfo.C3REMOTESENSOR) {
                ImageHelper.printC3RemoteSensorName(g2d, typePoint, linePoint, font, false, proto.isMixedTech() && TechConstants.isClan(proto.getTechLevel()));
            } else {
                g2d.drawString(name, typePoint, linePoint);
            }
            font = UnitUtil.deriveFont(7.0f);
            g2d.setFont(font);
            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) {
                        font = UnitUtil.deriveFont(6.0f);
                        g2d.setFont(font);
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(0, eqi.damage.indexOf('[')), font, damagePoint, linePoint);
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(eqi.damage.indexOf('[')), font, damagePoint, (linePoint + lineFeed) - 1.0f);
                        newLineNeeded = true;
                    } 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;
            }
            count++;
        }
    }
    if (proto.hasMyomerBooster()) {
        g2d.drawString("Protomech Myomer Booster", 115, 155 + (int) offset);
    }
    ImageHelperProto.printProtoAmmo(proto, g2d, (int) offset);
}
Also used : ArrayList(java.util.ArrayList) Font(java.awt.Font) AmmoType(megamek.common.AmmoType) Mounted(megamek.common.Mounted) Vector(java.util.Vector)

Example 3 with AmmoType

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

the class ImageHelperProto method printProtoAmmo.

public static void printProtoAmmo(Entity proto, Graphics2D g2d, int offset) {
    if (proto.getAmmo().size() < 1) {
        return;
    }
    int pointY = 160 + offset;
    int pointX = 124;
    HashMap<String, Integer> ammoHash = new HashMap<String, Integer>();
    for (Mounted ammo : proto.getAmmo()) {
        // don't print one shot ammo
        if (ammo.getLocation() == Entity.LOC_NONE) {
            continue;
        }
        AmmoType aType = (AmmoType) ammo.getType();
        String shortName = aType.getShortName().replace("Ammo", "");
        shortName = shortName.replace('(', '.').replace(')', '.').replace(".Clan.", "");
        shortName = shortName.replace("-capable", "");
        shortName += " ";
        if ((aType.getAmmoType() == AmmoType.T_AC) || (aType.getAmmoType() == AmmoType.T_MML) || (aType.getAmmoType() == AmmoType.T_SRM) || (aType.getAmmoType() == AmmoType.T_SRM_STREAK) || (aType.getAmmoType() == AmmoType.T_SRM_TORPEDO) || (aType.getAmmoType() == AmmoType.T_LRM) || (aType.getAmmoType() == AmmoType.T_LRM_STREAK) || (aType.getAmmoType() == AmmoType.T_LRM_TORPEDO) || (aType.getAmmoType() == AmmoType.T_MML) || (aType.getAmmoType() == AmmoType.T_AC) || (aType.getAmmoType() == AmmoType.T_AC_LBX) || (aType.getAmmoType() == AmmoType.T_AC_LBX_THB) || (aType.getAmmoType() == AmmoType.T_AC_ROTARY) || (aType.getAmmoType() == AmmoType.T_AC_ULTRA) || (aType.getAmmoType() == AmmoType.T_AC_ULTRA_THB) || (aType.getAmmoType() == AmmoType.T_MRM) || (aType.getAmmoType() == AmmoType.T_MRM_STREAK) || (aType.getAmmoType() == AmmoType.T_ATM) || (aType.getAmmoType() == AmmoType.T_HAG) || (aType.getAmmoType() == AmmoType.T_EXLRM)) {
            // shortName = shortName.replaceFirst(" ", " " +
            // aType.getRackSize() + " ");
            shortName = shortName.replaceFirst("  Artemis", " Artemis");
        }
        shortName = shortName.trim();
        if (ammoHash.containsKey(shortName)) {
            int currentAmmo = ammoHash.get(shortName);
            currentAmmo += ammo.getUsableShotsLeft();
            ammoHash.put(shortName, currentAmmo);
        } else {
            int currentAmmo = ammo.getUsableShotsLeft();
            ammoHash.put(shortName, currentAmmo);
        }
    }
    if (ammoHash.keySet().size() == 0) {
        return;
    }
    StringBuffer sb = new StringBuffer("Ammo: ");
    g2d.setFont(UnitUtil.getNewFont(g2d, sb.toString(), false, 20, 7.0f));
    sb = new StringBuffer("Ammo: ");
    int linecount = 0;
    for (String ammo : ammoHash.keySet()) {
        sb.append("(");
        sb.append(ammo);
        sb.append(") ");
        sb.append(ammoHash.get(ammo));
        sb.append(", ");
    }
    double stringLength = ImageHelper.getStringWidth(g2d, sb.toString(), g2d.getFont());
    linecount = (int) Math.floor(stringLength / 160);
    sb.setLength(0);
    sb.append("Ammo: ");
    g2d.drawString(sb.toString(), pointX, pointY - ((linecount) * ImageHelper.getStringHeight(g2d, sb.toString(), g2d.getFont())));
    pointX += ImageHelper.getStringWidth(g2d, sb.toString(), g2d.getFont());
    sb = new StringBuffer();
    int linesprinted = 0;
    int currentStringLength = 0;
    for (String ammo : ammoHash.keySet()) {
        currentStringLength = sb.length();
        sb.append("(");
        sb.append(ammo);
        sb.append(") ");
        sb.append(ammoHash.get(ammo));
        sb.append(", ");
        if ((ImageHelper.getStringWidth(g2d, sb.toString(), g2d.getFont()) > 160) && (linesprinted < linecount)) {
            sb.setLength(sb.length() - ((sb.length() - currentStringLength) + 2));
            g2d.drawString(sb.toString(), pointX, pointY - ((linecount - linesprinted) * ImageHelper.getStringHeight(g2d, sb.toString(), g2d.getFont())));
            linesprinted++;
            sb.setLength(0);
            sb.append("(");
            sb.append(ammo);
            sb.append(") ");
            sb.append(ammoHash.get(ammo));
            sb.append(", ");
        }
    }
    if (sb.length() > 0) {
        sb.setLength(sb.length() - 2);
        g2d.drawString(sb.toString(), pointX, pointY - ((linecount - linesprinted) * ImageHelper.getStringHeight(g2d, sb.toString(), g2d.getFont())));
        pointY += ImageHelper.getStringHeight(g2d, sb.toString(), g2d.getFont());
    }
}
Also used : AmmoType(megamek.common.AmmoType) HashMap(java.util.HashMap) Mounted(megamek.common.Mounted)

Example 4 with AmmoType

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

the class ImageHelperVehicle method printLargeSupportTankWeaponsNEquipment.

public static void printLargeSupportTankWeaponsNEquipment(Tank tank, Graphics2D g2d, float yoffset, float xoffset) {
    float qtyPoint = 26 + xoffset;
    float typePoint = 38 + xoffset;
    float locPoint = 124 + xoffset;
    float damagePoint = 150 + xoffset;
    float minPoint = 166 + xoffset;
    float shtPoint = 179 + xoffset;
    float medPoint = 195 + xoffset;
    float longPoint = 211 + xoffset;
    float maxHeight = 130.0f;
    float linePoint = 212f + yoffset;
    float lineFeed = 6.7f;
    boolean newLineNeeded = false;
    ArrayList<Hashtable<String, EquipmentInfo>> equipmentLocations = new ArrayList<Hashtable<String, EquipmentInfo>>(tank.locations());
    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;
    }
    if (tank.getTransportBays().size() > 0) {
        maxHeight -= lineFeed;
    }
    for (@SuppressWarnings("unused") Bay bay : tank.getTransportBays()) {
        maxHeight -= lineFeed;
    }
    if (tank.getAmmo().size() > 0) {
        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 = 0; pos <= tank.locations(); pos++) {
        Hashtable<String, EquipmentInfo> eqHash = equipmentLocations.get(pos);
        if (eqHash.size() < 1) {
            continue;
        }
        int count = 0;
        ArrayList<EquipmentInfo> equipmentList = new ArrayList<EquipmentInfo>();
        for (EquipmentInfo eqi : eqHash.values()) {
            equipmentList.add(eqi);
        }
        Collections.sort(equipmentList, StringUtils.equipmentInfoComparator());
        for (EquipmentInfo eqi : equipmentList) {
            newLineNeeded = false;
            if (count >= 12) {
                break;
            }
            g2d.drawString(Integer.toString(eqi.count), qtyPoint, linePoint);
            String name = eqi.name.trim();
            g2d.setFont(UnitUtil.getNewFont(g2d, name, false, 65, 7.0f));
            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);
            if (eqi.isSponsonMounted) {
                location += "po";
            }
            if (eqi.isPintleMounted) {
                location = location.substring(1) + "Pi";
            }
            g2d.setFont(UnitUtil.getNewFont(g2d, location, false, 18, 7));
            g2d.drawString(location, locPoint, linePoint);
            g2d.setFont(UnitUtil.deriveFont(7));
            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);
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(eqi.damage.indexOf('[')), font, damagePoint, (linePoint + lineFeed) - 1.0f);
                        newLineNeeded = true;
                    } 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);
                }
            }
            if (eqi.hasArtemis) {
                g2d.drawString("w/Artemis IV FCS", typePoint, linePoint + lineFeed);
                newLineNeeded = true;
            } else if (eqi.hasArtemisV) {
                g2d.drawString("w/Artemis V FCS", typePoint, linePoint + lineFeed);
                newLineNeeded = true;
            } else if (eqi.hasApollo) {
                g2d.drawString("w/Apollo FCS", typePoint, linePoint + lineFeed);
                newLineNeeded = true;
            }
            linePoint += lineFeed;
            if (newLineNeeded) {
                linePoint += lineFeed;
            }
            count++;
        }
    }
    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.setFont(UnitUtil.getNewFont(g2d, chassisMods, false, 200, 7.0f));
        g2d.drawString(chassisMods, qtyPoint, linePoint);
        g2d.setFont(font);
    }
    ImageHelperVehicle.printLargeVehicleCargo(tank, g2d, linePoint, xoffset, 0);
    ImageHelper.printVehicleAmmo(tank, g2d, yoffset, xoffset);
}
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 5 with AmmoType

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

the class ImageHelperVehicle method printTankWeaponsNEquipment.

public static void printTankWeaponsNEquipment(Tank tank, Graphics2D g2d, float yoffset, int xoffset) {
    int qtyPoint = 26 + xoffset;
    int typePoint = 38 + xoffset;
    int locPoint = 127 + xoffset;
    int damagePoint = 150 + xoffset;
    int minPoint = 167 + xoffset;
    int shtPoint = 182 + xoffset;
    int medPoint = 198 + xoffset;
    int longPoint = 213 + xoffset;
    float maxHeight = 130.3f;
    float linePoint = 212f + yoffset;
    float lineFeed = 6.7f;
    boolean newLineNeeded = false;
    ArrayList<Hashtable<String, EquipmentInfo>> equipmentLocations = new ArrayList<Hashtable<String, EquipmentInfo>>(tank.locations());
    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;
    }
    if (tank.getAmmo().size() > 0) {
        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>();
        for (EquipmentInfo eqi : eqHash.values()) {
            equipmentList.add(eqi);
        }
        Collections.sort(equipmentList, StringUtils.equipmentInfoComparator());
        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, 75, 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);
            // LS and RS, which results in "LSpo" and "RSpo"
            if (eqi.isSponsonMounted) {
                location += "po";
            }
            if (eqi.isPintleMounted) {
                location = location.substring(1) + "Pi";
            }
            g2d.setFont(font);
            g2d.drawString(location, locPoint, linePoint);
            if (eqi.isWeapon) {
                if (eqi.isAMS) {
                    g2d.drawString("\u2014", damagePoint, linePoint);
                    g2d.drawString("\u2014", minPoint, linePoint);
                    g2d.drawString("\u2014", shtPoint, linePoint);
                    g2d.drawString("\u2014", medPoint, linePoint);
                    g2d.drawString("\u2014", longPoint, linePoint);
                // g2d.drawLine(damagePoint, (int) linePoint - 2, damagePoint + 6, (int) linePoint - 2);
                // g2d.drawLine(minPoint, (int) linePoint - 2, minPoint + 6, (int) linePoint - 2);
                // g2d.drawLine(shtPoint, (int) linePoint - 2, shtPoint + 6, (int) linePoint - 2);
                // g2d.drawLine(medPoint, (int) linePoint - 2, medPoint + 6, (int) linePoint - 2);
                // g2d.drawLine(longPoint, (int) linePoint - 2, longPoint + 6, (int) linePoint - 2);
                } else 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) {
                        g2d.setFont(UnitUtil.deriveFont(g2d.getFont().getSize2D() - 1));
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(0, eqi.damage.indexOf('[')), font, damagePoint, linePoint);
                        g2d.setFont(font);
                        ImageHelper.printCenterString(g2d, eqi.damage.substring(eqi.damage.indexOf('[')), font, damagePoint, (linePoint + lineFeed) - 1.0f);
                        newLineNeeded = true;
                    } else {
                        ImageHelper.printCenterString(g2d, eqi.damage, font, damagePoint - 2, 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);
                    }
                    if (eqi.shtRange > 0) {
                        g2d.drawString(Integer.toString(eqi.shtRange), shtPoint, linePoint);
                    } else {
                        g2d.drawString("\u2014", shtPoint, linePoint);
                    // g2d.drawLine(shtPoint, (int) linePoint - 2, shtPoint + 6, (int) linePoint - 2);
                    }
                    if (eqi.medRange > 0) {
                        g2d.drawString(Integer.toString(eqi.medRange), medPoint, linePoint);
                    } else {
                        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);
                    }
                }
            } 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);
                }
            }
            if (eqi.hasArtemis) {
                g2d.drawString("w/Artemis IV FCS", typePoint, linePoint + lineFeed);
                newLineNeeded = true;
            } else if (eqi.hasArtemisV) {
                g2d.drawString("w/Artemis V FCS", typePoint, linePoint + lineFeed);
                newLineNeeded = true;
            } else if (eqi.hasApollo) {
                g2d.drawString("w/Apollo FCS", typePoint, linePoint + lineFeed);
                newLineNeeded = true;
            }
            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.setFont(UnitUtil.getNewFont(g2d, chassisMods, false, 205, 7.0f));
        g2d.drawString(chassisMods, qtyPoint, linePoint);
        g2d.setFont(font);
    }
    ImageHelper.printVehicleAmmo(tank, g2d, (int) yoffset == 0 ? 0 : (int) yoffset - 8, xoffset);
}
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)

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