Package l2p.gameserver.templates

Examples of l2p.gameserver.templates.L2Item


  {
    buyer_id = buyer.getObjectId();
    buyer_adena = buyer.getAdena();
    int _id, body_part, type2;
    long count, store_price, owner_price;
    L2Item tempItem;
    for(TradeItem e : buyer.getBuyList())
    {
      _id = e.getItemId();
      if((tempItem = ItemTable.getInstance().getTemplate(_id)) == null)
      {
        continue;
      }
      count = e.getCount();
      store_price = e.getStorePrice();
      body_part = tempItem.getBodyPart();
      type2 = tempItem.getType2ForPackets();
      owner_price = e.getOwnersPrice();
      buylist.add(new BuyItemInfo(_id, count, store_price, body_part, type2, owner_price));
    }
    _list = new L2TradeList(0);
    for(L2ItemInstance item : buyer.getInventory().getItems())
View Full Code Here


    writeD(player_obj_id);
    writeQ(char_adena);
    writeD(_itemslist.size());
    for(L2ItemInstance temp : _itemslist)
    {
      L2Item item = temp.getItem();
      writeH(item.getType1());
      writeD(temp.getObjectId());
      writeD(temp.getItemId());
      writeQ(temp.getCount());
      writeH(item.getType2ForPackets());
      writeH(temp.getCustomType1());
      writeD(temp.getBodyPart());
      writeH(temp.getEnchantLevel());
      writeH(temp.getCustomType2());
      writeH(0x00); // ?
View Full Code Here

    writeH(_whtype);
    writeQ(char_adena);
    writeH(_itemslist.size());
    for(L2ItemInstance temp : _itemslist)
    {
      L2Item item = temp.getItem();
      writeH(item.getType1());
      writeD(temp.getObjectId());
      writeD(temp.getItemId());
      writeQ(temp.getCount());
      writeH(item.getType2ForPackets());
      writeH(temp.getCustomType1());
      writeD(temp.getBodyPart());
      writeH(temp.getEnchantLevel());
      writeH(temp.getCustomType2());
      writeH(0x00); // ? 200
View Full Code Here

    writeD(0); // для писем с флагом "от news informer" в отправителе значится "****", всегда оверрайдит тип на просто письмо
    writeS(_letter.senderName); // от кого
    writeS(_letter.topic); // топик
    writeS(_letter.body); // тело
    writeD(_letter.attached.size()); // количество приложенных вещей
    L2Item item;
    for(TradeItem temp : _letter.attached)
    {
      item = temp.getItem();
      writeH(item.getType1());
      writeD(temp.getObjectId());
      writeD(temp.getItemId());
      writeQ(temp.getCount());
      writeD(temp.getEnchantLevel());
      writeD(0); // ?
View Full Code Here

    L2Player player = (L2Player) playable;
    L2ItemInstance weaponInst = player.getActiveWeaponInstance();
    L2Weapon weaponItem = player.getActiveWeaponItem();
    int SoulshotId = item.getItemId();
    boolean isAutoSoulShot = false;
    L2Item itemTemplate = ItemTable.getInstance().getTemplate(item.getItemId());
    if(player.getAutoSoulShot().contains(SoulshotId))
    {
      isAutoSoulShot = true;
    }
    if(weaponInst == null)
    {
      if(!isAutoSoulShot)
      {
        player.sendPacket(Msg.CANNOT_USE_SPIRITSHOTS);
      }
      return;
    }
    // spiritshot is already active
    if(weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
    {
      return;
    }
    int SpiritshotId = item.getItemId();
    int grade = weaponItem.getCrystalType().externalOrdinal;
    int soulSpiritConsumption = weaponItem.getSpiritShotCount();
    long count = item.getCount();
    if(soulSpiritConsumption == 0)
    {
      // Can't use Spiritshots
      if(isAutoSoulShot)
      {
        player.removeAutoSoulShot(SoulshotId);
        player.sendPacket(new ExAutoSoulShot(SoulshotId, false), new SystemMessage(SystemMessage.THE_AUTOMATIC_USE_OF_S1_WILL_NOW_BE_CANCELLED).addString(itemTemplate.getName()));
        return;
      }
      player.sendPacket(Msg.CANNOT_USE_SPIRITSHOTS);
      return;
    }
    if(grade == 0 && SpiritshotId != 5790 && SpiritshotId != 2509 // NG
      || grade == 1 && SpiritshotId != 2510 && SpiritshotId != 22077 // D
      || grade == 2 && SpiritshotId != 2511 && SpiritshotId != 22078 // C
      || grade == 3 && SpiritshotId != 2512 && SpiritshotId != 22079 // B
      || grade == 4 && SpiritshotId != 2513 && SpiritshotId != 22080 // A
      || grade == 5 && SpiritshotId != 2514 && SpiritshotId != 22081 // S
      )
    {
      // wrong grade for weapon
      if(isAutoSoulShot)
      {
        return;
      }
      player.sendPacket(Msg.SPIRITSHOT_DOES_NOT_MATCH_WEAPON_GRADE);
      return;
    }
    if(count < soulSpiritConsumption)
    {
      if(isAutoSoulShot)
      {
        player.removeAutoSoulShot(SoulshotId);
        player.sendPacket(new ExAutoSoulShot(SoulshotId, false), new SystemMessage(SystemMessage.THE_AUTOMATIC_USE_OF_S1_WILL_NOW_BE_CANCELLED).addString(itemTemplate.getName()));
        return;
      }
      player.sendPacket(Msg.NOT_ENOUGH_SPIRITSHOTS);
      return;
    }
View Full Code Here

    writeD(buyer_id);
    writeQ(seller_adena);
    writeD(_buyerslist.size());
    for(TradeItem buyersitem : _buyerslist)
    {
      L2Item tmp = ItemTable.getInstance().getTemplate(buyersitem.getItemId());
      writeD(buyersitem.getObjectId());
      writeD(buyersitem.getItemId());
      writeH(buyersitem.getEnchantLevel());
      writeQ(buyersitem.getCurrentValue()); //give max possible sell amount
      writeQ(tmp.getReferencePrice());
      writeH(0);
      writeD(tmp.getBodyPart());
      writeH(tmp.getType2ForPackets());
      writeQ(buyersitem.getOwnersPrice());
      writeQ(buyersitem.getCount()); // maximum possible tradecount
      writeItemElements(buyersitem);
      writeItemRev152();
    }
View Full Code Here

    if(itemToEnchant.getOwnerId() != activeChar.getObjectId())
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    L2Item item = itemToEnchant.getItem();
    // only weapon & armor
    if(!item.isWeapon() && !item.isArmor())
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    // only S80 & S84
    if(item.getCrystalType().cry != L2Item.CRYSTAL_S)
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    // only normal weapons & armors
    @SuppressWarnings("rawtypes")
    Enum type = item.getItemType();
    if(type == WeaponType.ETC || type == WeaponType.PET || type == ArmorType.PET || type == ArmorType.SIGIL)
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    if((!Config.AttributToPvpItem && item.isPvP()) || item.isUnderwear() || item.isBelt())
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    if(!itemToEnchant.canBeEnchanted() && !(item.isCloak() && Config.ALLOW_ATTRIBUTE_CLOAKS))
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    if(itemToEnchant.getLocation() != L2ItemInstance.ItemLocation.INVENTORY && itemToEnchant.getLocation() != L2ItemInstance.ItemLocation.PAPERDOLL)
    {
      activeChar.sendPacket(Msg.INAPPROPRIATE_ENCHANT_CONDITIONS, Msg.ActionFail);
      return;
    }
    if(activeChar.getPrivateStoreType() != L2Player.STORE_PRIVATE_NONE)
    {
      activeChar.sendPacket(Msg.YOU_CANNOT_ADD_ELEMENTAL_POWER_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP, Msg.ActionFail);
      return;
    }
    if(itemToEnchant.isStackable() || (stone = inventory.getItemByObjectId(stone.getObjectId())) == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    int itemType2 = item.getType2();
    if(itemToEnchant.getAttributeElement() != L2Item.ATTRIBUTE_NONE && itemToEnchant.getAttributeElement() != stone.getEnchantAttributeStoneElement(itemType2 == L2Item.TYPE2_SHIELD_ARMOR))
    {
      activeChar.sendPacket(Msg.ANOTHER_ELEMENTAL_POWER_HAS_ALREADY_BEEN_ADDED_THIS_ELEMENTAL_POWER_CANNOT_BE_ADDED, Msg.ActionFail);
      return;
    }
View Full Code Here

TOP

Related Classes of l2p.gameserver.templates.L2Item

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.