Exemplo n.º 1
0
    public boolean setCrop() {
      synchronized (_crop) {
        int amount = _crop.getAmount();
        if (_count > amount) return false; // not enough crops

        _crop.setAmount(amount - _count);
      }

      if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
        CastleManager.getInstance()
            .getCastleById(_manorId)
            .updateCrop(_itemId, _crop.getAmount(), CastleManorManager.PERIOD_CURRENT);

      return true;
    }
Exemplo n.º 2
0
    public boolean getCrop() {
      try {
        _crop =
            CastleManager.getInstance()
                .getCastleById(_manorId)
                .getCrop(_itemId, CastleManorManager.PERIOD_CURRENT);
      } catch (NullPointerException e) {
        return false;
      }

      if (_crop == null || _crop.getId() == 0 || _crop.getPrice() == 0 || _count == 0) return false;

      if (_count > _crop.getAmount()) return false;

      if ((Integer.MAX_VALUE / _count) < _crop.getPrice()) return false;

      _reward = L2Manor.getInstance().getRewardItem(_itemId, _crop.getReward());
      return true;
    }
Exemplo n.º 3
0
 public int getPrice() {
   return _crop.getPrice() * _count;
 }