private EquipmentStatsPto createStatsPto(IEquipmentItem item, IEquipmentStats stats) {
   EquipmentStatsPto statsPto = new EquipmentStatsPto();
   statsPto.id = stats.getId();
   IEquipmentStats stat = item.getStat(stats.getId());
   EquipmentOptionsProvider optionProvider = heroModel.getOptionProvider();
   IEquipmentStatsOption[] enabledStatOptions = optionProvider.getEnabledStatOptions(item, stat);
   for (IEquipmentStatsOption option : enabledStatOptions) {
     EquipmentOptionPto optionPto = new EquipmentOptionPto();
     optionPto.name = option.getName();
     optionPto.type = option.getType();
   }
   return statsPto;
 }
 @Override
 public boolean transferOptions(IEquipmentItem fromItem, IEquipmentItem toItem) {
   if (fromItem == null || toItem == null) {
     return false;
   }
   boolean transferred = false;
   for (IEquipmentStats fromStats : fromItem.getStats()) {
     List<IEquipmentStatsOption> optionList = optionsTable.get(fromItem, fromStats);
     optionsTable.add(fromItem, fromStats, null);
     IEquipmentStats toStats = toItem.getStat(fromStats.getId());
     if (toStats != null && optionList != null) {
       optionsTable.add(toItem, toStats, optionList);
       transferred = true;
     }
   }
   return transferred;
 }
示例#3
0
  @Override
  public boolean transferOptions(IEquipmentItem fromItem, IEquipmentItem toItem) {
    boolean transferred = false;
    if (fromItem != null && toItem != null) {
      for (IEquipmentStats fromStats : fromItem.getStats()) {
        List<IEquipmentStatsOption> specialtyList = optionsTable.remove(fromItem, fromStats);
        boolean printCheckboxEnabled = fromItem.isPrintEnabled(fromStats);
        IEquipmentStats toStats = toItem.getStat(fromStats.getId());

        if (toStats != null) {
          transferred = true;
          if (specialtyList != null) {
            optionsTable.put(toItem, toStats, specialtyList);
          }
          toItem.setPrintEnabled(toStats, printCheckboxEnabled);
        }
      }
    }
    return transferred;
  }