Examples of SeedProduction


Examples of com.l2jfrozen.gameserver.managers.CastleManorManager.SeedProduction

      int seedId = _items[i * 2 + 0];
      int count = _items[i * 2 + 1];
      int price = 0;
      int residual = 0;

      SeedProduction seed = castle.getSeed(seedId, CastleManorManager.PERIOD_CURRENT);
      price = seed.getPrice();
      residual = seed.getCanProduce();

      if(price <= 0)
        return;

      if(residual < count)
        return;

      totalPrice += count * price;

      L2Item template = ItemTable.getInstance().getTemplate(seedId);
      totalWeight += count * template.getWeight();
      if(!template.isStackable())
      {
        slots += count;
      }
      else if(player.getInventory().getItemByItemId(seedId) == null)
      {
        slots++;
      }
    }

    if(totalPrice > Integer.MAX_VALUE)
    {
      Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + Integer.MAX_VALUE + " adena worth of goods.", Config.DEFAULT_PUNISH);
      return;
    }

    if(!player.getInventory().validateWeight(totalWeight))
    {
      sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
      return;
    }

    if(!player.getInventory().validateCapacity(slots))
    {
      sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
      return;
    }

    // Charge buyer
    if(totalPrice < 0 || !player.reduceAdena("Buy", (int) totalPrice, target, false))
    {
      sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
      return;
    }

    // Adding to treasury for Manor Castle
    castle.addToTreasuryNoTax((int) totalPrice);

    // Proceed the purchase
    InventoryUpdate playerIU = new InventoryUpdate();
    for(int i = 0; i < _count; i++)
    {
      int seedId = _items[i * 2 + 0];
      int count = _items[i * 2 + 1];

      if(count < 0)
      {
        count = 0;
      }

      // Update Castle Seeds Amount
      SeedProduction seed = castle.getSeed(seedId, CastleManorManager.PERIOD_CURRENT);
      seed.setCanProduce(seed.getCanProduce() - count);
      if(Config.ALT_MANOR_SAVE_ALL_ACTIONS)
      {
        CastleManager.getInstance().getCastleById(_manorId).updateSeed(seed.getId(), seed.getCanProduce(), CastleManorManager.PERIOD_CURRENT);
      }

      // Add item to Inventory and adjust update packet
      L2ItemInstance item = player.getInventory().addItem("Buy", seedId, count, player, target);

View Full Code Here

Examples of com.l2jfrozen.gameserver.managers.CastleManorManager.SeedProduction

      int id = _items[i * 3 + 0];
      int sales = _items[i * 3 + 1];
      int price = _items[i * 3 + 2];
      if(id > 0)
      {
        SeedProduction s = CastleManorManager.getInstance().getNewSeedProduction(id, sales, price, sales);
        seeds.add(s);
      }
    }

    CastleManager.getInstance().getCastleById(_manorId).setSeedProduction(seeds, CastleManorManager.PERIOD_NEXT);
View Full Code Here

Examples of com.l2jfrozen.gameserver.managers.CastleManorManager.SeedProduction

      _seedData[i * 12 + 3] = L2Manor.getInstance().getRewardItemBySeed(s, 2);
      _seedData[i * 12 + 4] = L2Manor.getInstance().getSeedSaleLimit(s);
      _seedData[i * 12 + 5] = L2Manor.getInstance().getSeedBuyPrice(s);
      _seedData[i * 12 + 6] = L2Manor.getInstance().getSeedBasicPrice(s) * 60 / 100;
      _seedData[i * 12 + 7] = L2Manor.getInstance().getSeedBasicPrice(s) * 10;
      SeedProduction seedPr = c.getSeed(s, CastleManorManager.PERIOD_CURRENT);
      if(seedPr != null)
      {
        _seedData[i * 12 + 8] = seedPr.getStartProduce();
        _seedData[i * 12 + 9] = seedPr.getPrice();
      }
      else
      {
        _seedData[i * 12 + 8] = 0;
        _seedData[i * 12 + 9] = 0;
      }
      seedPr = c.getSeed(s, CastleManorManager.PERIOD_NEXT);
      if(seedPr != null)
      {
        _seedData[i * 12 + 10] = seedPr.getStartProduce();
        _seedData[i * 12 + 11] = seedPr.getPrice();
      }
      else
      {
        _seedData[i * 12 + 10] = 0;
        _seedData[i * 12 + 11] = 0;
View Full Code Here

Examples of l2p.gameserver.instancemanager.CastleManorManager.SeedProduction

      int id = (int) _items[i * 3 + 0];
      long sales = _items[i * 3 + 1];
      long price = _items[i * 3 + 2];
      if(id > 0)
      {
        SeedProduction s = CastleManorManager.getInstance().getNewSeedProduction(id, sales, price, sales);
        seeds.add(s);
      }
    }
    CastleManager.getInstance().getCastleByIndex(_manorId).setSeedProduction(seeds, CastleManorManager.PERIOD_NEXT);
    CastleManager.getInstance().getCastleByIndex(_manorId).saveSeedData(CastleManorManager.PERIOD_NEXT);
View Full Code Here

Examples of l2p.gameserver.instancemanager.CastleManorManager.SeedProduction

    {
      int seedId = (int) _items[i * 2 + 0];
      long count = _items[i * 2 + 1];
      long price = 0;
      long residual = 0;
      SeedProduction seed = castle.getSeed(seedId, CastleManorManager.PERIOD_CURRENT);
      price = seed.getPrice();
      residual = seed.getCanProduce();
      if(price <= 0)
      {
        return;
      }
      if(residual < count)
      {
        return;
      }
      try
      {
        totalPrice = SafeMath.safeAddLong(totalPrice, SafeMath.safeMulLong(count, price));
      }
      catch(ArithmeticException e)
      {
        Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + Long.MAX_VALUE + " adena worth of goods.\r\n" + e.getMessage(), "", Config.DEFAULT_PUNISH);
        return;
      }
      L2Item template = ItemTable.getInstance().getTemplate(seedId);
      totalWeight += count * template.getWeight();
      if(!template.isStackable())
      {
        slots += count;
      }
      else if(player.getInventory().getItemByItemId(seedId) == null)
      {
        slots++;
      }
    }
    if(!player.getInventory().validateWeight(totalWeight))
    {
      sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
      return;
    }
    if(!player.getInventory().validateCapacity(slots))
    {
      sendPacket(Msg.YOUR_INVENTORY_IS_FULL);
      return;
    }
    // Charge buyer
    if(totalPrice < 0 || player.getAdena() < totalPrice)
    {
      sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      return;
    }
    player.reduceAdena(totalPrice, true);
    // Adding to treasury for Manor Castle
    castle.addToTreasuryNoTax((int) totalPrice, false, true);
    Log.add(castle.getName() + "|" + (int) totalPrice + "|BuySeed", "treasury");
    // Proceed the purchase
    for(int i = 0; i < _count; i++)
    {
      int seedId = (int) _items[i * 2 + 0];
      long count = _items[i * 2 + 1];
      if(count < 0)
      {
        count = 0;
      }
      // Update Castle Seeds Amount
      SeedProduction seed = castle.getSeed(seedId, CastleManorManager.PERIOD_CURRENT);
      seed.setCanProduce(seed.getCanProduce() - count);
      CastleManager.getInstance().getCastleByIndex(_manorId).updateSeed(seed.getId(), seed.getCanProduce(), CastleManorManager.PERIOD_CURRENT);
      // Add item to Inventory and adjust update packet
      player.getInventory().addItem(seedId, count);
      player.sendPacket(SystemMessage.obtainItems(seedId, count, 0));
    }
    player.sendStatusUpdate(false, StatusUpdate.CUR_LOAD);
View Full Code Here

Examples of l2p.gameserver.instancemanager.CastleManorManager.SeedProduction

      _seedData[i * 12 + 3] = L2Manor.getInstance().getRewardItemBySeed(s, 2);
      _seedData[i * 12 + 4] = L2Manor.getInstance().getSeedSaleLimit(s);
      _seedData[i * 12 + 5] = L2Manor.getInstance().getSeedBuyPrice(s);
      _seedData[i * 12 + 6] = L2Manor.getInstance().getSeedBasicPrice(s) * 60 / 100;
      _seedData[i * 12 + 7] = L2Manor.getInstance().getSeedBasicPrice(s) * 10;
      SeedProduction seedPr = c.getSeed(s, CastleManorManager.PERIOD_CURRENT);
      if(seedPr != null)
      {
        _seedData[i * 12 + 8] = seedPr.getStartProduce();
        _seedData[i * 12 + 9] = seedPr.getPrice();
      }
      else
      {
        _seedData[i * 12 + 8] = 0;
        _seedData[i * 12 + 9] = 0;
      }
      seedPr = c.getSeed(s, CastleManorManager.PERIOD_NEXT);
      if(seedPr != null)
      {
        _seedData[i * 12 + 10] = seedPr.getStartProduce();
        _seedData[i * 12 + 11] = seedPr.getPrice();
      }
      else
      {
        _seedData[i * 12 + 10] = 0;
        _seedData[i * 12 + 11] = 0;
View Full Code Here

Examples of lineage2.gameserver.templates.manor.SeedProduction

          long startProduce = rs.getLong("start_produce");
          long price = rs.getLong("seed_price");
          int period = rs.getInt("period");
          if (period == PERIOD_CURRENT)
          {
            production.add(new SeedProduction(seedId, canProduce, price, startProduce));
          }
          else
          {
            productionNext.add(new SeedProduction(seedId, canProduce, price, startProduce));
          }
        }
        DbUtils.close(statement, rs);
        castle.setSeedProduction(production, PERIOD_CURRENT);
        castle.setSeedProduction(productionNext, PERIOD_NEXT);
View Full Code Here

Examples of lineage2.gameserver.templates.manor.SeedProduction

  {
    List<SeedProduction> seeds = new ArrayList<>();
    List<Integer> seedsIds = Manor.getInstance().getSeedsForCastle(castleId);
    for (int sd : seedsIds)
    {
      seeds.add(new SeedProduction(sd));
    }
    return seeds;
  }
View Full Code Here

Examples of lineage2.gameserver.templates.manor.SeedProduction

   * @param sales long
   * @return SeedProduction
   */
  public SeedProduction getNewSeedProduction(int id, long amount, long price, long sales)
  {
    return new SeedProduction(id, amount, price, sales);
  }
View Full Code Here

Examples of lineage2.gameserver.templates.manor.SeedProduction

      _seedData[i * 12 + 3] = Manor.getInstance().getRewardItemBySeed(s, 2);
      _seedData[i * 12 + 4] = Manor.getInstance().getSeedSaleLimit(s);
      _seedData[i * 12 + 5] = Manor.getInstance().getSeedBuyPrice(s);
      _seedData[i * 12 + 6] = Manor.getInstance().getSeedBasicPrice(s) * 60 / 100;
      _seedData[i * 12 + 7] = Manor.getInstance().getSeedBasicPrice(s) * 10;
      SeedProduction seedPr = c.getSeed(s, CastleManorManager.PERIOD_CURRENT);
      if (seedPr != null)
      {
        _seedData[i * 12 + 8] = seedPr.getStartProduce();
        _seedData[i * 12 + 9] = seedPr.getPrice();
      }
      else
      {
        _seedData[i * 12 + 8] = 0;
        _seedData[i * 12 + 9] = 0;
      }
      seedPr = c.getSeed(s, CastleManorManager.PERIOD_NEXT);
      if (seedPr != null)
      {
        _seedData[i * 12 + 10] = seedPr.getStartProduce();
        _seedData[i * 12 + 11] = seedPr.getPrice();
      }
      else
      {
        _seedData[i * 12 + 10] = 0;
        _seedData[i * 12 + 11] = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.