Beispiel #1
0
 public MyAsset(
     final Item item,
     final MyLocation location,
     final Owner owner,
     final long count,
     final List<MyAsset> parents,
     final String flag,
     final int flagID,
     final long itemID,
     final boolean singleton,
     final int rawQuantity) {
   this.item = item;
   this.location = location;
   this.owner = owner;
   this.count = count;
   this.parents = parents;
   this.flag = flag;
   this.flagID = flagID;
   this.itemID = itemID;
   this.volume = item.getVolume();
   this.singleton = singleton;
   this.rawQuantity = rawQuantity;
   // The order matter!
   // 1st
   // rawQuantity: -1 = BPO. Only BPOs can be packaged (singleton == false). Only packaged items
   // can be stacked (count > 1)
   this.bpo = (item.isBlueprint() && (rawQuantity == -1 || !singleton || count > 1));
   // rawQuantity: -2 = BPC
   this.bpc = (item.isBlueprint() && rawQuantity == -2);
   // 2nd
   if (item.isBlueprint()) {
     if (isBPO()) {
       this.typeName = item.getTypeName() + " (BPO)";
     } else if (isBPC()) {
       this.typeName = item.getTypeName() + " (BPC)";
     } else {
       this.bpc = true;
       this.typeName = item.getTypeName() + " (BP)";
     }
   } else {
     this.typeName = item.getTypeName();
   }
   // 3rd
   this.name = getTypeName();
 }
  private static double getPriceType(
      final int typeID, final boolean isBlueprintCopy, boolean reprocessed) {
    UserItem<Integer, Double> userPrice;
    if (isBlueprintCopy) { // Blueprint Copy
      userPrice = Settings.get().getUserPrices().get(-typeID);
    } else { // All other
      userPrice = Settings.get().getUserPrices().get(typeID);
    }
    if (userPrice != null) {
      return userPrice.getValue();
    }

    // Blueprint Copy (Default Zero)
    if (isBlueprintCopy) {
      return 0;
    }

    // Blueprints Base Price
    Item item = getItem(typeID);
    // Tech 1
    if (item.isBlueprint()) {
      if (Settings.get().isBlueprintBasePriceTech1()
          && !item.getTypeName().toLowerCase().contains("ii")) {
        return item.getPriceBase();
      }
      // Tech 2
      if (Settings.get().isBlueprintBasePriceTech2()
          && item.getTypeName().toLowerCase().contains("ii")) {
        return item.getPriceBase();
      }
    }

    // Price data
    PriceData priceData = Settings.get().getPriceData().get(typeID);
    if (priceData != null && priceData.isEmpty()) {
      priceData = null;
    }
    if (reprocessed) {
      return Settings.get().getPriceDataSettings().getDefaultPriceReprocessed(priceData);
    } else {
      return Settings.get().getPriceDataSettings().getDefaultPrice(priceData);
    }
  }
 private void autoValidate() {
   boolean valid = true;
   boolean color = false;
   if (jItems.getSelectedItem() == null) {
     valid = false;
     jCopy.setEnabled(false);
     jCopy.setSelected(false);
   } else {
     Item item = (Item) jItems.getSelectedItem();
     boolean blueprint = item.getTypeName().toLowerCase().contains("blueprint");
     jCopy.setEnabled(blueprint);
     if (!blueprint) {
       jCopy.setSelected(blueprint);
     }
   }
   if (itemExist() || stockpileItem != null) {
     color = true;
     jCountMinimum.setBackground(new Color(255, 255, 200));
   }
   try {
     double d = Double.valueOf(jCountMinimum.getText());
     if (d <= 0) {
       valid = false; // Negative and zero is not valid
       color = true;
       jCountMinimum.setBackground(new Color(255, 200, 200));
     }
   } catch (NumberFormatException ex) {
     valid = false; // Empty and NaN is not valid
     if (!jCountMinimum.getText().isEmpty()) {
       color = true;
       jCountMinimum.setBackground(new Color(255, 200, 200));
     }
   }
   if (!color) {
     jCountMinimum.setBackground(Color.WHITE);
   }
   jOK.setEnabled(valid);
 }
 @Override
 public void getFilterStrings(final List<String> baseList, final Item element) {
   baseList.add(element.getTypeName());
 }