Package lineage2.gameserver.model.items

Examples of lineage2.gameserver.model.items.Warehouse


   * @param killer Creature
   */
  @Override
  protected void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    boolean isOverhit = false;
    if (actor instanceof MonsterInstance)
    {
      isOverhit = ((MonsterInstance) actor).getOverhitDamage() > 0;
    }
    final int npcId = actor.getNpcId();
    int nextId = 0;
    int type = 0;
    if ((npcId != getNextDoppler(npcId)) && (npcId != getNextVoid(npcId)))
    {
      type = 1;
      if (isOverhit)
      {
        if (Rnd.chance(70))
        {
          nextId = getNextDoppler(npcId);
        }
        else if (Rnd.chance(80))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(65))
      {
        nextId = getNextDoppler(npcId);
      }
    }
    else if (npcId == getNextDoppler(npcId))
    {
      type = 2;
      if (isOverhit)
      {
        if (Rnd.chance(60))
        {
          nextId = getNextDoppler(npcId);
        }
        else if (Rnd.chance(90))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(40))
      {
        nextId = getNextDoppler(npcId);
      }
      else if (Rnd.chance(50))
      {
        nextId = getNextVoid(npcId);
      }
    }
    else if (npcId == getNextVoid(npcId))
    {
      type = 3;
      if (isOverhit)
      {
        if (Rnd.chance(80))
        {
          nextId = getNextVoid(npcId);
        }
      }
      else if (Rnd.chance(50))
      {
        nextId = getNextVoid(npcId);
      }
    }
    final Reflection r = actor.getReflection();
    boolean spawnPossible = true;
    if (r instanceof KamalokaNightmare)
    {
      final KamalokaNightmare kama = (KamalokaNightmare) r;
      kama.addKilledKanabion(type);
View Full Code Here


            oldOwner = getOwner();
            if (oldOwner != null) {
                long amount = getTreasury();
                if (amount > 0) {
                    Warehouse warehouse = oldOwner.getWarehouse();
                    if (warehouse != null) {
                        warehouse.addItem(ItemTemplate.ITEM_ID_ADENA, amount);
                        addToTreasuryNoTax(-amount, false, false);
                        Log.add(getName() + "|" + -amount + "|Castle:changeOwner", "treasury");
                    }
                }
View Full Code Here

      Clan clan = ClanTable.getInstance().getClan(c.getOwnerId());
      if (clan == null)
      {
        continue;
      }
      Warehouse cwh = clan.getWarehouse();
      for (CropProcure crop : c.getCropProcure(PERIOD_CURRENT))
      {
        if (crop.getStartAmount() == 0)
        {
          continue;
        }
        if (crop.getStartAmount() > crop.getAmount())
        {
          _log.info("Manor System [" + c.getName() + "]: Start Amount of Crop " + crop.getStartAmount() + " > Amount of current " + crop.getAmount());
          long count = crop.getStartAmount() - crop.getAmount();
          count = (count * 90) / 100;
          if ((count < 1) && (Rnd.get(99) < 90))
          {
            count = 1;
          }
          if (count >= 1)
          {
            int id = Manor.getInstance().getMatureCrop(crop.getId());
            cwh.addItem(id, count);
          }
        }
        if (crop.getAmount() > 0)
        {
          c.addToTreasuryNoTax(crop.getAmount() * crop.getPrice(), false, false);
View Full Code Here

    if ((whkeeper == null) || !activeChar.isInRange(whkeeper, Creature.INTERACTION_DISTANCE))
    {
      activeChar.sendPacket(Msg.WAREHOUSE_IS_TOO_FAR);
      return;
    }
    Warehouse warehouse = null;
    String logType = null;
    if (activeChar.getUsingWarehouseType() == WarehouseType.PRIVATE)
    {
      warehouse = activeChar.getWarehouse();
      logType = Log.WarehouseWithdraw;
    }
    else if (activeChar.getUsingWarehouseType() == WarehouseType.CLAN)
    {
      logType = Log.ClanWarehouseWithdraw;
      boolean canWithdrawCWH = false;
      if (activeChar.getClan() != null)
      {
        if (((activeChar.getClanPrivileges() & Clan.CP_CL_WAREHOUSE_SEARCH) == Clan.CP_CL_WAREHOUSE_SEARCH) && (Config.ALT_ALLOW_OTHERS_WITHDRAW_FROM_CLAN_WAREHOUSE || activeChar.isClanLeader() || activeChar.getVarB("canWhWithdraw")))
        {
          canWithdrawCWH = true;
        }
      }
      if (!canWithdrawCWH)
      {
        return;
      }
      warehouse = activeChar.getClan().getWarehouse();
    }
    else if (activeChar.getUsingWarehouseType() == WarehouseType.FREIGHT)
    {
      warehouse = activeChar.getFreight();
      logType = Log.FreightWithdraw;
    }
    else
    {
      _log.warn("Error retrieving a warehouse object for char " + activeChar.getName() + " - using warehouse type: " + activeChar.getUsingWarehouseType());
      return;
    }
    PcInventory inventory = activeChar.getInventory();
    inventory.writeLock();
    warehouse.writeLock();
    try
    {
      long weight = 0;
      int slots = 0;
      for (int i = 0; i < _count; i++)
      {
        ItemInstance item = warehouse.getItemByObjectId(_items[i]);
        if ((item == null) || (item.getCount() < _itemQ[i]))
        {
          activeChar.sendPacket(SystemMsg.INCORRECT_ITEM_COUNT);
          return;
        }
        weight = SafeMath.addAndCheck(weight, SafeMath.mulAndCheck(item.getTemplate().getWeight(), _itemQ[i]));
        if (!item.isStackable() || (inventory.getItemByItemId(item.getItemId()) == null))
        {
          slots++;
        }
      }
      if (!activeChar.getInventory().validateCapacity(slots))
      {
        activeChar.sendPacket(Msg.YOUR_INVENTORY_IS_FULL);
        return;
      }
      if (!activeChar.getInventory().validateWeight(weight))
      {
        activeChar.sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT);
        return;
      }
      for (int i = 0; i < _count; i++)
      {
        ItemInstance item = warehouse.removeItemByObjectId(_items[i], _itemQ[i]);
        Log.LogItem(activeChar, logType, item);
        activeChar.getInventory().addItem(item);
      }
    }
    catch (ArithmeticException ae)
    {
      sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
      return;
    }
    finally
    {
      warehouse.writeUnlock();
      inventory.writeUnlock();
    }
    activeChar.sendChanges();
    activeChar.sendPacket(Msg.THE_TRANSACTION_IS_COMPLETE);
  }
View Full Code Here

      activeChar.sendPacket(Msg.WAREHOUSE_IS_TOO_FAR);
      return;
    }
    PcInventory inventory = activeChar.getInventory();
    boolean privatewh = activeChar.getUsingWarehouseType() != WarehouseType.CLAN;
    Warehouse warehouse;
    if (privatewh)
    {
      warehouse = activeChar.getWarehouse();
    }
    else
    {
      warehouse = activeChar.getClan().getWarehouse();
    }
    inventory.writeLock();
    warehouse.writeLock();
    try
    {
      int slotsleft = 0;
      long adenaDeposit = 0;
      if (privatewh)
      {
        slotsleft = activeChar.getWarehouseLimit() - warehouse.getSize();
      }
      else
      {
        slotsleft = (activeChar.getClan().getWhBonus() + Config.WAREHOUSE_SLOTS_CLAN) - warehouse.getSize();
      }
      int items = 0;
      for (int i = 0; i < _count; i++)
      {
        ItemInstance item = inventory.getItemByObjectId(_items[i]);
        if ((item == null) || (item.getCount() < _itemQ[i]) || !item.canBeStored(activeChar, privatewh))
        {
          _items[i] = 0;
          _itemQ[i] = 0L;
          continue;
        }
        if (!item.isStackable() || (warehouse.getItemByItemId(item.getItemId()) == null))
        {
          if (slotsleft <= 0)
          {
            _items[i] = 0;
            _itemQ[i] = 0L;
            continue;
          }
          slotsleft--;
        }
        if (item.getItemId() == ItemTemplate.ITEM_ID_ADENA)
        {
          adenaDeposit = _itemQ[i];
        }
        items++;
      }
      if (slotsleft <= 0)
      {
        activeChar.sendPacket(Msg.YOUR_WAREHOUSE_IS_FULL);
      }
      if (items == 0)
      {
        activeChar.sendPacket(SystemMsg.INCORRECT_ITEM_COUNT);
        return;
      }
      long fee = SafeMath.mulAndCheck(items, _WAREHOUSE_FEE);
      if ((fee + adenaDeposit) > activeChar.getAdena())
      {
        activeChar.sendPacket(Msg.YOU_LACK_THE_FUNDS_NEEDED_TO_PAY_FOR_THIS_TRANSACTION);
        return;
      }
      if (!activeChar.reduceAdena(fee, true))
      {
        sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
        return;
      }
      for (int i = 0; i < _count; i++)
      {
        if (_items[i] == 0)
        {
          continue;
        }
        ItemInstance item = inventory.removeItemByObjectId(_items[i], _itemQ[i]);
        Log.LogItem(activeChar, privatewh ? Log.WarehouseDeposit : Log.ClanWarehouseDeposit, item);
        warehouse.addItem(item);
      }
    }
    catch (ArithmeticException ae)
    {
      sendPacket(Msg.YOU_HAVE_EXCEEDED_THE_QUANTITY_THAT_CAN_BE_INPUTTED);
      return;
    }
    finally
    {
      warehouse.writeUnlock();
      inventory.writeUnlock();
    }
    activeChar.sendChanges();
    activeChar.sendPacket(Msg.THE_TRANSACTION_IS_COMPLETE);
  }
View Full Code Here

  {
    if (!player.getPlayerAccess().UseWarehouse)
    {
      return false;
    }
    Warehouse warehouse = null;
    switch (type)
    {
      case PRIVATE:
        warehouse = player.getWarehouse();
        break;
      case FREIGHT:
        warehouse = player.getFreight();
        break;
      case CLAN:
      case CASTLE:
        if ((player.getClan() == null) || (player.getClan().getLevel() == 0))
        {
          player.sendPacket(Msg.ONLY_CLANS_OF_CLAN_LEVEL_1_OR_HIGHER_CAN_USE_A_CLAN_WAREHOUSE);
          return false;
        }
        boolean canWithdrawCWH = false;
        if (player.getClan() != null)
        {
          if ((player.getClanPrivileges() & Clan.CP_CL_WAREHOUSE_SEARCH) == Clan.CP_CL_WAREHOUSE_SEARCH)
          {
            canWithdrawCWH = true;
          }
        }
        if (!canWithdrawCWH)
        {
          player.sendPacket(Msg.YOU_DO_NOT_HAVE_THE_RIGHT_TO_USE_THE_CLAN_WAREHOUSE);
          return false;
        }
        warehouse = player.getClan().getWarehouse();
        break;
      default:
        return false;
    }
    if (warehouse.getSize() == 0)
    {
      player.sendPacket(type == WarehouseType.FREIGHT ? SystemMsg.NO_PACKAGES_HAVE_ARRIVED : Msg.YOU_HAVE_NOT_DEPOSITED_ANY_ITEMS_IN_YOUR_WAREHOUSE);
      return false;
    }
    return true;
View Full Code Here

      Player player = cha.getPlayer();
     
      QuestState qs = player.getQuestState(_10301_ShadowOfTerrorBlackishRedFog.class);
      if(qs != null && qs.getCond() == 3 && player.getVar("instance10301") == null)
      {
        Quest q = QuestManager.getQuest(10301);
        player.processQuestEvent(q.getName(), "enterInstance", null);
        //player.setVar("instance10301", "true", -1);
        return;
      }
      if (!player.getVarB("@25_20_telzone_to_magmeld"))
      {
View Full Code Here

    {
      htmltext = "32640-10.htm";
    }
    else if (id == CREATED)
    {
      QuestState ImTheOnlyOneYouCanTrust = st.getPlayer().getQuestState(_240_ImTheOnlyOneYouCanTrust.class);
      if ((st.getPlayer().getLevel() >= 81) && (ImTheOnlyOneYouCanTrust != null) && ImTheOnlyOneYouCanTrust.isCompleted())
      {
        htmltext = "32640-1.htm";
      }
      else
      {
View Full Code Here

      {
        return;
      }
      Player player = cha.getPlayer();
     
      QuestState qs = player.getQuestState(_10301_ShadowOfTerrorBlackishRedFog.class);
      if(qs != null && qs.getCond() == 3 && player.getVar("instance10301") == null)
      {
        Quest q = QuestManager.getQuest(10301);
        player.processQuestEvent(q.getName(), "enterInstance", null);
        //player.setVar("instance10301", "true", -1);
        return;
View Full Code Here

      if (cha.isPlayer())
      {
        Player player = cha.getPlayer();
        if (!player.getVarB("@ti_present_video"))
        {
          QuestState qs = player.getQuestState(_10320_LetsGototheCentralSquare.class);
          if ((qs != null) && (qs.getCond() == 1))
          {
            player.showQuestMovie(SceneMovie.si_illusion_02_que);
          }
          else
          {
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.items.Warehouse

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.