Package l2p.gameserver.templates

Examples of l2p.gameserver.templates.L2Item


    if(itemId == 57)
    {
      Log.add("Quest|" + getQuest().getQuestIntId() + "|" + count + "|" + player.getName(), "adena");
    }
    // Get template of item
    L2Item template = ItemTable.getInstance().getTemplate(itemId);
    if(template == null)
    {
      return null;
    }
    L2ItemInstance ret = null;
    if(template.isStackable())
    {
      L2ItemInstance item = ItemTable.getInstance().createItem(itemId);
      // Set quantity of item
      item.setCount(count);
      // Add items to player's inventory
      ret = player.getInventory().addItem(item);
      if(enchantlevel > 0)
      {
        item.setEnchantLevel(enchantlevel);
      }
      Log.LogItem(player, Log.GetQuestItem, item);
    }
    else
    {
      for(int i = 0; i < count; i++)
      {
        L2ItemInstance item = ItemTable.getInstance().createItem(itemId);
        // Add items to player's inventory
        ret = player.getInventory().addItem(item);
        if(enchantlevel > 0)
        {
          item.setEnchantLevel(enchantlevel);
        }
        Log.LogItem(player, Log.GetQuestItem, item);
      }
    }
    player.sendPacket(SystemMessage.obtainItems(template.getItemId(), count, 0));
    player.sendStatusUpdate(false, StatusUpdate.CUR_LOAD);
    return ret;
  }
View Full Code Here


    if(count <= 0)
    {
      count = 1;
    }
    // Get template of item
    L2Item template = ItemTable.getInstance().getTemplate(itemId);
    if(template == null)
    {
      return;
    }
    for(int i = 0; i < count; i++)
    {
      L2ItemInstance item = ItemTable.getInstance().createItem(itemId);
      if(attributeId >= 0 && attributeLevel > 0)
      {
        item.setAttributeElement(attributeId, attributeLevel, true);
      }
      // Add items to player's inventory
      player.getInventory().addItem(item);
      Log.LogItem(player, Log.GetQuestItem, item);
    }
    player.sendPacket(SystemMessage.obtainItems(template.getItemId(), count, 0));
    player.sendStatusUpdate(false, StatusUpdate.CUR_LOAD);
  }
View Full Code Here

        }
        if(tempItem.enchant < minEnchant)
        {
          continue;
        }
        L2Item temp = ItemTable.getInstance().getTemplate(tempItem.itemId);
        if(temp == null || rare > 0 && !temp.isRare())
        {
          continue;
        }
        if(itemClass == null ? !temp.isCommonItem() : temp.isCommonItem())
        {
          continue;
        }
        if(itemClass != null && itemClass != ItemClass.ALL && temp.getItemClass() != itemClass)
        {
          continue;
        }
        tempItems2.put(entry.getKey(), tempItem);
      }
      if(tempItems2.isEmpty())
      {
        continue;
      }
      Item item = type == L2Player.STORE_PRIVATE_BUY ? tempItems2.lastEntry().getValue() : tempItems2.firstEntry().getValue();
      if(item != null)
      {
        items.add(item);
      }
    }
    StringBuffer out = new StringBuffer("[npc_%objectId%_Chat " + ("1" + type) + "|««]&nbsp;");
    int pages = Math.max(1, items.size() / countPerPage + 1);
    if(pages > 1)
    {
      for(int j = 1; j <= pages; j++)
      {
        if(min == (j - 1) * countPerPage + 1)
        {
          out.append(j).append("&nbsp;");
        }
        else
        {
          out.append("[scripts_services.ItemBroker:list ").append(type).append(" ").append(itemType).append(" ").append(((j - 1) * countPerPage + 1)).append(" ").append((j * countPerPage)).append(" ").append(minEnchant).append(" ").append(rare).append("|").append(j).append("]&nbsp;");
        }
      }
    }
    out.append("<table width=100%>");
    int i = 0;
    for(Item item : items)
    {
      i++;
      if(i < min || i > max)
      {
        continue;
      }
      L2Item temp = ItemTable.getInstance().getTemplate(item.itemId);
      if(temp == null)
      {
        continue;
      }
      String icon = "<img src=icon." + temp.getIcon() + " width=32 height=32>";
      String color = "<font color=\"LEVEL\">";
      if(item.enchant > 0)
      {
        color = "<font color=\"7CFC00\">+" + item.enchant + " ";
      }
      if(temp.isRare())
      {
        color = "<font color=\"0000FF\">Rare ";
      }
      if(temp.isRare() && item.enchant > 0)
      {
        color = "<font color=\"FF0000\">+" + item.enchant + " Rare ";
      }
      out.append("<tr><td>").append(icon);
      out.append("</td><td><table width=100%><tr><td>[scripts_services.ItemBroker:listForItem ").append(type).append(" ").append(item.itemId).append(" ").append(minEnchant).append(" ").append(rare).append(" ").append(itemType).append(" ").append(min).append(" ").append(max).append("|");
      out.append(color).append(item.name).append("</font>]").append(parseElement(item)).append("</td></tr><tr><td>price: ").append(Util.formatAdena(item.price));
      if(temp.isStackable())
      {
        out.append(", count: ").append(Util.formatAdena(item.count));
      }
      out.append("</td></tr></table></td></tr>");
    }
View Full Code Here

    catch(Exception e)
    {
      show("Некорректные данные", player, npc);
      return;
    }
    L2Item template = ItemTable.getInstance().getTemplate(itemId);
    if(template == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
    TreeMap<String, TreeMap<Long, Item>> allItems = getItems(type);
    if(allItems == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
    TreeMap<Long, Item> items = allItems.get(template.getName());
    if(items == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
    StringBuffer out = new StringBuffer("[scripts_services.ItemBroker:list " + type + " " + itemType + " " + min + " " + max + " " + minEnchant + " " + rare + "|««]");
    out.append("<table width=100%>");
    NavigableMap<Long, Item> sortedItems = type == L2Player.STORE_PRIVATE_BUY ? items.descendingMap() : items;
    if(sortedItems == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
    int i = 0;
    for(Item item : sortedItems.values())
    {
      if(item.enchant < minEnchant)
      {
        continue;
      }
      L2Item temp = ItemTable.getInstance().getTemplate(item.itemId);
      if(temp == null || rare > 0 && !temp.isRare())
      {
        continue;
      }
      i++;
      if(i > maxItems)
      {
        break;
      }
      String icon = "<img src=icon." + temp.getIcon() + " width=32 height=32>";
      String color = "<font color=\"LEVEL\">";
      if(item.enchant > 0)
      {
        color = "<font color=\"7CFC00\">+" + item.enchant + " ";
      }
      if(temp.isRare())
      {
        color = "<font color=\"0000FF\">Rare ";
      }
      if(temp.isRare() && item.enchant > 0)
      {
        color = "<font color=\"FF0000\">+" + item.enchant + " Rare ";
      }
      out.append("<tr><td>").append(icon);
      out.append("</td><td><table width=100%><tr><td>[scripts_services.ItemBroker:path ");
      out.append(type).append(" ").append(item.itemId).append(" ").append(item.itemObjId).append("|");
      out.append(color).append(item.name).append("</font>]").append(parseElement(item)).append("</td></tr><tr><td>price: ").append(Util.formatAdena(item.price));
      if(temp.isStackable())
      {
        out.append(", count: ").append(Util.formatAdena(item.count));
      }
      out.append(", owner: ").append(item.merchantName);
      out.append("</td></tr></table></td></tr>");
View Full Code Here

    catch(Exception e)
    {
      show("Некорректные данные", player, npc);
      return;
    }
    L2Item temp = ItemTable.getInstance().getTemplate(itemId);
    if(temp == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
    TreeMap<String, TreeMap<Long, Item>> allItems = getItems(type);
    if(allItems == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
    TreeMap<Long, Item> items = allItems.get(temp.getName());
    if(items == null)
    {
      show("Неизвестная ошибка", player, npc);
      return;
    }
View Full Code Here

              case L2Player.STORE_PRIVATE_SELL:
                items = info.bestSellItems;
                tradeList = pl.getSellList();
                for(TradeItem item : tradeList)
                {
                  L2Item temp = ItemTable.getInstance().getTemplate(item.getItemId());
                  if(temp == null)
                  {
                    continue;
                  }
                  TreeMap<Long, Item> oldItems = items.get(temp.getName());
                  if(oldItems == null)
                  {
                    oldItems = new TreeMap<Long, Item>();
                    items.put(temp.getName(), oldItems);
                  }
                  Item newItem = new Item(item.getItemId(), type, item.getOwnersPrice(), item.getCount(), item.getEnchantLevel(), temp.getName(), pl.getStoredId(), pl.getName(), path, item.getObjectId(), new Element(item));
                  long key = newItem.price * 100;
                  while(key < newItem.price * 100 + 100 && oldItems.containsKey(key))
                  // До 100 предметов с одинаковыми ценами
                  {
                    key++;
                  }
                  oldItems.put(key, newItem);
                }
                break;
              case L2Player.STORE_PRIVATE_BUY:
                items = info.bestBuyItems;
                tradeList = pl.getBuyList();
                for(TradeItem item : tradeList)
                {
                  L2Item temp = ItemTable.getInstance().getTemplate(item.getItemId());
                  if(temp == null)
                  {
                    continue;
                  }
                  TreeMap<Long, Item> oldItems = items.get(temp.getName());
                  if(oldItems == null)
                  {
                    oldItems = new TreeMap<Long, Item>();
                    items.put(temp.getName(), oldItems);
                  }
                  Item newItem = new Item(item.getItemId(), type, item.getOwnersPrice(), item.getCount(), item.getEnchantLevel(), temp.getName(), pl.getStoredId(), pl.getName(), path, itemObjId++, new Element(item));
                  long key = newItem.price * 100;
                  while(key < newItem.price * 100 + 100 && oldItems.containsKey(key))
                  // До 100 предметов с одинаковыми ценами
                  {
                    key++;
                  }
                  oldItems.put(key, newItem);
                }
                break;
              case L2Player.STORE_PRIVATE_MANUFACTURE:
                items = info.bestCraftItems;
                L2ManufactureList createList = pl.getCreateList();
                if(createList == null)
                {
                  continue;
                }
                for(L2ManufactureItem mitem : createList.getList())
                {
                  int recipeId = mitem.getRecipeId();
                  L2Recipe recipe = RecipeController.getInstance().getRecipeByRecipeId(recipeId);
                  if(recipe == null)
                  {
                    continue;
                  }
                  L2Item temp = ItemTable.getInstance().getTemplate(recipe.getItemId());
                  if(temp == null)
                  {
                    continue;
                  }
                  TreeMap<Long, Item> oldItems = items.get(temp.getName());
                  if(oldItems == null)
                  {
                    oldItems = new TreeMap<Long, Item>();
                    items.put(temp.getName(), oldItems);
                  }
                  Item newItem = new Item(recipe.getItemId(), type, mitem.getCost(), recipe.getCount(), 0, temp.getName(), pl.getStoredId(), pl.getName(), path, itemObjId++, null);
                  long key = newItem.price * 100;
                  while(key < newItem.price * 100 + 100 && oldItems.containsKey(key))
                  // До 100 предметов с одинаковыми ценами
                  {
                    key++;
View Full Code Here

      i++;
      if(i < min || i > max)
      {
        continue;
      }
      L2Item temp = ItemTable.getInstance().getTemplate(item.itemId);
      if(temp == null)
      {
        continue;
      }
      out.append("<tr><td>").append("<img src=icon.").append(temp.getIcon()).append(" width=32 height=32>");
      out.append("</td><td><table width=100%><tr><td>[scripts_services.ItemBroker:listForItem ").append(type).append(" ").append(item.itemId).append(" ").append(0).append(" ").append(0).append(" ").append(0).append(" ").append(min).append(" ").append(max).append("|");
      out.append("<font color=\"LEVEL\">").append(item.name).append("</font>]").append("</td></tr>");
      out.append("</table></td></tr>");
    }
    out.append("</table><br>&nbsp;");
View Full Code Here

    if(!Config.SERVICES_EXPAND_INVENTORY_ENABLED)
    {
      show("Сервис отключен.", player);
      return;
    }
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_EXPAND_INVENTORY_ITEM);
    String out = "";
    out += "<html><body>Расширение инвентаря";
    out += "<br><br><table>";
    out += "<tr><td>Текущий размер:</td><td>" + player.getInventoryLimit() + "</td></tr>";
    out += "<tr><td>Максимальный размер:</td><td>" + Config.SERVICES_EXPAND_INVENTORY_MAX + "</td></tr>";
    out += "<tr><td>Стоимость слота:</td><td>" + Config.SERVICES_EXPAND_INVENTORY_PRICE + " " + item.getName() + "</td></tr>";
    out += "</table><br><br>";
    out += "<button width=100 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" action=\"bypass -h scripts_services.ExpandInventory:get\" value=\"Расширить\">";
    out += "</body></html>";
    show(out, player);
  }
View Full Code Here

    if(player.getClan() == null)
    {
      player.sendMessage("У вас нет клана.");
      return;
    }
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_EXPAND_CWH_ITEM);
    L2ItemInstance pay = player.getInventory().getItemByItemId(item.getItemId());
    if(pay != null && pay.getCount() >= Config.SERVICES_EXPAND_CWH_PRICE)
    {
      player.getInventory().destroyItem(pay, Config.SERVICES_EXPAND_CWH_PRICE, true);
      player.getClan().setWhBonus(player.getClan().getWhBonus() + 1);
      player.sendMessage("Warehouse capacity is now " + (Config.WAREHOUSE_SLOTS_CLAN + player.getClan().getWhBonus()));
View Full Code Here

    if(!Config.SERVICES_EXCHANGE_BABY_PET_ENABLED)
    {
      show("Сервис отключен.", player);
      return;
    }
    L2Item item = ItemTable.getInstance().getTemplate(Config.SERVICES_EXCHANGE_BABY_PET_ITEM);
    String out = "";
    out += "<html><body>Вы можете в любое время обменять вашего Improved Baby пета на другой вид, без потери опыта. Пет при этом должен быть вызван.";
    out += "<br>Стоимость обмена: " + Util.formatAdena(Config.SERVICES_EXCHANGE_BABY_PET_PRICE) + " " + item.getName();
    out += "<br><button width=250 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" action=\"bypass -h scripts_services.petevolve.exchange:exToCougar\" value=\"Обменять на Improved Cougar\">";
    out += "<br1><button width=250 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" action=\"bypass -h scripts_services.petevolve.exchange:exToBuffalo\" value=\"Обменять на Improved Buffalo\">";
    out += "<br1><button width=250 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\" action=\"bypass -h scripts_services.petevolve.exchange:exToKookaburra\" value=\"Обменять на Improved Kookaburra\">";
    out += "</body></html>";
    show(out, player);
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.