⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hmvfile.java

📁 MegaMek is a networked Java clone of BattleTech, a turn-based sci-fi boardgame for 2+ players. Fight
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    mixedEquipment.put(new Long(0xE4), "CLSRTorpedo6");    mixedEquipment.put(new Long(0xF4), "CLHeavyLargeLaser");    mixedEquipment.put(new Long(0xF5), "CLHeavyMediumLaser");    mixedEquipment.put(new Long(0xF6), "CLHeavySmallLaser");    mixedEquipment.put(new Long(0xFC), "CLATM3");    mixedEquipment.put(new Long(0xFD), "CLATM6");    mixedEquipment.put(new Long(0xFE), "CLATM9");    mixedEquipment.put(new Long(0xFF), "CLATM12");        //but ammo *seems* to use the same numbers as the weapon it goes with    Hashtable mixedAmmo = new Hashtable(isAmmo);    AMMO.put(HMVTechType.MIXED, mixedAmmo);    mixedAmmo.put(new Long(0x5E), "CLLightMG Ammo");    mixedAmmo.put(new Long(0x5F), "CLHeavyMG Ammo");    mixedAmmo.put(new Long(0xB4), "CLAntiMissileSystem Ammo");    mixedAmmo.put(new Long(0xB5), "CLGaussRifle Ammo");    mixedAmmo.put(new Long(0xB6), "CLLBXAC2 Ammo");    mixedAmmo.put(new Long(0xB7), "CLLBXAC5 Ammo");    mixedAmmo.put(new Long(0xB8), "CLLBXAC10 Ammo");    mixedAmmo.put(new Long(0xB9), "CLLBXAC20 Ammo");    mixedAmmo.put(new Long(0xBA), "CLMG Ammo");    mixedAmmo.put(new Long(0xBB), "CLUltraAC2 Ammo");    mixedAmmo.put(new Long(0xBC), "CLUltraAC5 Ammo");    mixedAmmo.put(new Long(0xBD), "CLUltraAC10 Ammo");    mixedAmmo.put(new Long(0xBE), "CLUltraAC20 Ammo");    mixedAmmo.put(new Long(0xBF), "CLLRM5 Ammo");    mixedAmmo.put(new Long(0xC0), "CLLRM10 Ammo");    mixedAmmo.put(new Long(0xC1), "CLLRM15 Ammo");    mixedAmmo.put(new Long(0xC2), "CLLRM20 Ammo");    mixedAmmo.put(new Long(0xC3), "CLSRM2 Ammo");    mixedAmmo.put(new Long(0xC4), "CLSRM4 Ammo");    mixedAmmo.put(new Long(0xC5), "CLSRM6 Ammo");    mixedAmmo.put(new Long(0xC6), "CLStreakSRM2 Ammo");    mixedAmmo.put(new Long(0xC7), "CLStreakSRM4 Ammo");    mixedAmmo.put(new Long(0xC8), "CLStreakSRM6 Ammo");    mixedAmmo.put(new Long(0xC9), "CLArrowIVSystem Ammo");    mixedAmmo.put(new Long(0xCD), "CLNarcBeacon Ammo");    mixedAmmo.put(new Long(0xDA), "CLVehicleFlamer Ammo");    mixedAmmo.put(new Long(0xDB), "CLLongTomArtillery Ammo");    mixedAmmo.put(new Long(0xDC), "CLSniperArtillery Ammo");    mixedAmmo.put(new Long(0xDD), "CLThumperArtillery Ammo");    mixedAmmo.put(new Long(0xDE), "CLLRTorpedo5 Ammo");    mixedAmmo.put(new Long(0xDF), "CLLRTorpedo10 Ammo");    mixedAmmo.put(new Long(0xE0), "CLLRTorpedo15 Ammo");    mixedAmmo.put(new Long(0xE1), "CLLRTorpedo20 Ammo");    mixedAmmo.put(new Long(0xE2), "CLSRTorpedo2 Ammo");    mixedAmmo.put(new Long(0xE3), "CLSRTorpedo4 Ammo");    mixedAmmo.put(new Long(0xE4), "CLSRTorpedo6 Ammo");      }  private String getEquipmentName(long equipment, HMVTechType techType)  {    return getEquipmentName(new Long(equipment), techType);  }  private String getEquipmentName(Long equipment, HMVTechType techType)  {    if (equipment.longValue() > Short.MAX_VALUE)    {      equipment = new Long(equipment.longValue() & 0xFFFF);    }    final long value = equipment.longValue();    String equipName = (String) EQUIPMENT.get(equipment);    if (equipName == null)    {      Hashtable techEquipment = (Hashtable) EQUIPMENT.get(techType);      if (techEquipment != null)      {        equipName = (String) techEquipment.get(equipment);      }    }    // Report unexpected parsing failures.    if (equipName == null &&        value != 0  &&     // 0x00 Empty        value != 7  &&     // 0x07 Lower Leg Actuator (on a quad)        value != 8  &&     // 0x08 Foot Actuator (on a quad)        value != 15)    {    // 0x0F Fusion Engine      System.out.print("unknown critical: 0x");      System.out.print(Integer.toHexString(equipment.intValue())                              .toUpperCase());      System.out.print( " (" );      System.out.print( techType );      System.out.println( ")" );    }    return equipName;  }  private EquipmentType getEquipmentType(long equipment, HMVTechType techType)  {    EquipmentType equipmentType = null;    String equipmentName = getEquipmentName(equipment, techType);    if (equipmentName != null)    {      equipmentType = EquipmentType.get(equipmentName);            if(equipmentType == null) {          failedEquipment.add(equipmentName);      }    }    else {        failedEquipment.add("Unknown Equipment ("+Long.toHexString(equipment)+")");    }    return equipmentType;  }  private String getAmmoName(long ammo, HMVTechType techType)  {    return getAmmoName(new Long(ammo), techType);  }  private String getAmmoName(Long ammo, HMVTechType techType)  {    if (ammo.longValue() > Short.MAX_VALUE)    {      ammo= new Long(ammo.longValue() & 0xFFFF);    }    final long value = ammo.longValue();    String ammoName = (String) AMMO.get(equipment);    if (ammoName == null)    {      Hashtable techAmmo = (Hashtable) AMMO.get(techType);      if (techAmmo != null)      {        ammoName = (String) techAmmo.get(ammo);      }    }    // Report unexpected parsing failures.    if (ammoName == null &&        value != 0)    {      System.out.print("unknown critical: 0x");      System.out.print(Integer.toHexString(ammo.intValue())                              .toUpperCase());      System.out.print( " (" );      System.out.print( techType );      System.out.println( ")" );    }    return ammoName;  }  private AmmoType getAmmoType(long ammo, HMVTechType techType)  {    AmmoType ammoType = null;    String ammoName = getAmmoName(ammo, techType);    if (ammoName != null)    {      ammoType = (AmmoType) EquipmentType.get(ammoName);    }    return ammoType;  }    /*  public static void main(String[] args)    throws Exception  {    for (int i = 0; i < args.length; i++)    {      HmvFile hmvFile = new HmvFile(new FileInputStream(args[i]));      System.out.println(new megamek.client.ui.AWT.MechView(hmvFile.getEntity()).getMechReadout());    }  }    */}abstract class HMVType{    private String name;    private int id;    protected HMVType(String name, int id) {        this.name = name;        this.id = id;    }    public String toString() {        return name;    }    public boolean equals( Object other ) {        // Assume the other object doesn't equal this one.        boolean result = false;        // References to the same object are equal.        if ( this == other ) {            result = true;        }        // If the other object is an instance of        // this object's class, then recast it.        else if ( this.getClass().isInstance(other) ) {            HMVType cast = (HMVType) other;            // The two objects match if their names and IDs match.            if ( this.name.equals(cast.name) &&                 this.id == cast.id ) {                result = true;            }        }        // Return the result        return result;    }    public int getId() {        return id;    }}class HMVEngineType  extends HMVType{  public static final Hashtable types = new Hashtable();  public static final HMVEngineType ICE = new HMVEngineType("I.C.E.", 0);  public static final HMVEngineType FUSION = new HMVEngineType("Fusion", 1);  public static final HMVEngineType XLFUSION = new HMVEngineType("XL Fusion", 2);  public static final HMVEngineType XXLFUSION = new HMVEngineType("XXL Fusion", 3);  public static final HMVEngineType LIGHTFUSION = new HMVEngineType("Light Fusion", 4);  private HMVEngineType(String name, int id)  {    super(name, id);    types.put(new Integer(id), this);  }  public static HMVEngineType getType(int i)  {    return (HMVEngineType) types.get(new Integer(i));  }}class HMVArmorType  extends HMVType{  public static final Hashtable types = new Hashtable();  public static final HMVArmorType STANDARD = new HMVArmorType(EquipmentType.getArmorTypeName(EquipmentType.T_ARMOR_STANDARD), 0);  public static final HMVArmorType FERRO = new HMVArmorType(EquipmentType.getArmorTypeName(EquipmentType.T_ARMOR_FERRO_FIBROUS), 1);//  public static final HMVArmorType COMPACT = new HMVArmorType("Compact", 2);//  public static final HMVArmorType LASER = new HMVArmorType("Laser", 3);  private HMVArmorType(String name, int id)  {    super(name, id);    types.put(new Integer(id), this);  }  public static HMVArmorType getType(int i)  {    return (HMVArmorType) types.get(new Integer(i));  }}class HMVTechType  extends HMVType{  public static final Hashtable types = new Hashtable();  public static final HMVTechType INNER_SPHERE = new HMVTechType("Inner Sphere", 0);  public static final HMVTechType CLAN = new HMVTechType("Clan", 1);  public static final HMVTechType MIXED = new HMVTechType("Mixed", 2);  private HMVTechType(String name, int id)  {    super(name, id);    types.put(new Integer(id), this);  }  public static HMVTechType getType(int i)  {    return (HMVTechType) types.get(new Integer(i));  }}class HMVMovementType  extends HMVType{  public static final Hashtable types = new Hashtable();  public static final HMVMovementType TRACKED =    new HMVMovementType("Tracked", 8);  public static final HMVMovementType WHEELED =    new HMVMovementType("Wheeled", 16);  public static final HMVMovementType HOVER =    new HMVMovementType("Hover", 32);  public static final HMVMovementType VTOL =    new HMVMovementType("V.T.O.L", 64);  public static final HMVMovementType HYDROFOIL =    new HMVMovementType("Hydrofoil", 128);  public static final HMVMovementType SUBMARINE =    new HMVMovementType("Submarine", 256);  public static final HMVMovementType DISPLACEMENT_HULL =    new HMVMovementType("Displacement Hull", 512);  private HMVMovementType(String name, int id)  {    super(name, id);    types.put(new Integer(id), this);  }  public static HMVMovementType getType(int i)  {      // Only pay attention to the movement type bits.      i &= 1016;      return (HMVMovementType) types.get(new Integer(i));  }}class HMVWeaponLocation  extends HMVType{  public static final Hashtable types = new Hashtable();  public static final HMVWeaponLocation TURRET =    new HMVWeaponLocation("Turret", 0);  public static final HMVWeaponLocation FRONT =    new HMVWeaponLocation("Front", 1);  public static final HMVWeaponLocation LEFT =    new HMVWeaponLocation("Left", 2);  public static final HMVWeaponLocation RIGHT =    new HMVWeaponLocation("Right", 3);  public static final HMVWeaponLocation REAR =    new HMVWeaponLocation("Rear", 4);  public static final HMVWeaponLocation BODY =    new HMVWeaponLocation("Body", 5);  private HMVWeaponLocation(String name, int id)  {    super(name, id);    types.put(new Integer(id), this);  }  public static HMVWeaponLocation getType(int i)  {    return (HMVWeaponLocation) types.get(new Integer(i));  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -