Package lineage2.gameserver.templates.manor

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


      _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

      {
        int seedId = _items[i];
        long count = _itemQ[i];
        long price = 0;
        long residual = 0;
        SeedProduction seed = castle.getSeed(seedId, CastleManorManager.PERIOD_CURRENT);
        price = seed.getPrice();
        residual = seed.getCanProduce();
        if (price < 1)
        {
          return;
        }
        if (residual < count)
        {
          return;
        }
        totalPrice = SafeMath.addAndCheck(totalPrice, SafeMath.mulAndCheck(count, price));
        ItemTemplate item = ItemHolder.getInstance().getTemplate(seedId);
        if (item == null)
        {
          return;
        }
        weight = SafeMath.addAndCheck(weight, SafeMath.mulAndCheck(count, item.getWeight()));
        if (!item.isStackable() || (activeChar.getInventory().getItemByItemId(seedId) == null))
        {
          slots++;
        }
      }
    }
    catch (ArithmeticException ae)
    {
      sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
      return;
    }
    activeChar.getInventory().writeLock();
    try
    {
      if (!activeChar.getInventory().validateWeight(weight))
      {
        sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
        return;
      }
      if (!activeChar.getInventory().validateCapacity(slots))
      {
        sendPacket(Msg.YOUR_INVENTORY_IS_FULL);
        return;
      }
      if (!activeChar.reduceAdena(totalPrice, true))
      {
        sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
        return;
      }
      castle.addToTreasuryNoTax(totalPrice, false, true);
      for (int i = 0; i < _count; i++)
      {
        int seedId = _items[i];
        long count = _itemQ[i];
        SeedProduction seed = castle.getSeed(seedId, CastleManorManager.PERIOD_CURRENT);
        seed.setCanProduce(seed.getCanProduce() - count);
        castle.updateSeed(seed.getId(), seed.getCanProduce(), CastleManorManager.PERIOD_CURRENT);
        activeChar.getInventory().addItem(seedId, count);
        activeChar.sendPacket(SystemMessage2.obtainItems(seedId, count, 0));
      }
    }
    finally
View Full Code Here

      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);
      }
    }
    caslte.setSeedProduction(seeds, CastleManorManager.PERIOD_NEXT);
    caslte.saveSeedData(CastleManorManager.PERIOD_NEXT);
View Full Code Here

   * @param template NpcTemplate
   */
  public Kama26BossInstance(int objectId, NpcTemplate template)
  {
    super(objectId, template);
    getMinionList().addMinion(new MinionData(18556, 1));
  }
View Full Code Here

    ThreadPoolManager.getInstance().schedule(new RunnableImpl()
    {
      @Override
      public void runImpl()
      {
        final NpcTemplate template = NpcHolder.getInstance().getTemplate(18602);
        if (template != null)
        {
          final NpcInstance a = template.getNewInstance();
          a.setCurrentHpMp(a.getMaxHp(), a.getMaxMp());
          a.spawnMe(actor.getLoc());
        }
      }
    }, 10000L);
View Full Code Here

      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
    final Location pos = Location.findPointToStay(x, y, z, 50, 100, player.getGeoIndex());
    if (price > 0)
    {
      player.reduceAdena(price, true);
    }
    player.teleToLocation(pos);
View Full Code Here

      player.sendPacket(SystemMessage2.removeItems(item, count));
    }
    final int x = Integer.parseInt(param[0]);
    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final Location pos = Location.findPointToStay(x, y, z, 20, 70, player.getGeoIndex());
    player.teleToLocation(pos);
  }
View Full Code Here

      return;
    }
    final String var = player.getVar("DCBackCoords");
    if ((var == null) || var.isEmpty())
    {
      player.teleToLocation(new Location(43768, -48232, -800), 0);
      return;
    }
    player.teleToLocation(Location.parseLoc(var), 0);
    player.unsetVar("DCBackCoords");
  }
View Full Code Here

    }
    for (Player player : World.getAroundPlayers(actor, 200, 200))
    {
      if (player != null)
      {
        player.teleToLocation(new Location(207559, 86429, -1000));
      }
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.templates.manor.SeedProduction

Copyright © 2018 www.massapicom. 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.