Package l2p.gameserver.model.items

Examples of l2p.gameserver.model.items.L2ItemInstance$LazyUpdateInDb


    {
      for(L2Object obj : L2World.getAroundObjects(actor, 300, 200))
      {
        if(obj.isItem())
        {
          L2ItemInstance item = (L2ItemInstance) obj;
          if(item.getItemId() == Crystal_Fragment)
          {
            if(Rnd.chance(50))
            {
              Functions.npcSay(actor, says[Rnd.get(says.length)]);
            }
            itemToConsume = item;
            lastPoint = actor.getLoc();
            actor.setRunning();
            addTaskMove(item.getLoc(), false);
            return true;
          }
        }
      }
    }
View Full Code Here


      if(_pet.getControlItemObjId() != dragonflute_id)
      {
        return false;
      }
    }
    L2ItemInstance dragonflute = GetDragonflute(st);
    if(dragonflute == null)
    {
      return false;
    }
    if(PetDataTable.getControlItemId(_pet.getNpcId()) != dragonflute.getItemId())
    {
      return false;
    }
    return true;
  }
View Full Code Here

  @Override
  public String onEvent(String event, QuestState st, L2NpcInstance npc)
  {
    int _state = st.getState();
    L2ItemInstance dragonflute = GetDragonflute(st);
    int dragonflute_id = st.getInt("dragonflute");
    int cond = st.getInt("cond");
    if(event.equalsIgnoreCase("30610_05.htm") && _state == CREATED)
    {
      st.setState(STARTED);
      st.set("cond", "1");
      st.playSound(SOUND_ACCEPT);
    }
    else if((event.equalsIgnoreCase("30747_03.htm") || event.equalsIgnoreCase("30747_04.htm")) && _state == STARTED && cond == 1)
    {
      if(dragonflute == null)
      {
        return "noquest";
      }
      if(dragonflute.getObjectId() != dragonflute_id)
      {
        if(Rnd.chance(10))
        {
          st.takeItems(dragonflute.getItemId(), 1);
          st.playSound(SOUND_FINISH);
          st.exitCurrentQuest(true);
        }
        return "30747_00.htm";
      }
View Full Code Here

  public String onTalk(L2NpcInstance npc, QuestState st)
  {
    int _state = st.getState();
    int npcId = npc.getNpcId();
    int cond = st.getInt("cond");
    L2ItemInstance dragonflute = GetDragonflute(st);
    int dragonflute_id = st.getInt("dragonflute");
    if(_state == CREATED)
    {
      if(npcId != Cronos)
      {
        return "noquest";
      }
      if(st.getPlayer().getLevel() < 45)
      {
        st.exitCurrentQuest(true);
        return "30610_01.htm";
      }
      if(dragonflute == null)
      {
        st.exitCurrentQuest(true);
        return "30610_02.htm";
      }
      if(dragonflute.getEnchantLevel() < 55)
      {
        st.exitCurrentQuest(true);
        return "30610_03.htm";
      }
      st.set("cond", "0");
      st.set("dragonflute", String.valueOf(dragonflute.getObjectId()));
      return "30610_04.htm";
    }
    if(_state != STARTED)
    {
      return "noquest";
    }
    if(npcId == Cronos)
    {
      if(dragonflute == null)
      {
        return "30610_02.htm";
      }
      return dragonflute.getObjectId() == dragonflute_id ? "30610_07.htm" : "30610_06.htm";
    }
    if(npcId == Mimyu)
    {
      if(st.getQuestItemsCount(Dragon_Bugle_of_Wind) + st.getQuestItemsCount(Dragon_Bugle_of_Star) + st.getQuestItemsCount(Dragon_Bugle_of_Twilight) > 0)
      {
        return "30747_00b.htm";
      }
      if(dragonflute == null)
      {
        return "noquest";
      }
      if(cond == 1)
      {
        return "30747_01.htm";
      }
      if(cond == 2)
      {
        if(!HatchlingSummoned(st, false))
        {
          return "30747_09.htm";
        }
        if(st.getQuestItemsCount(Fairy_Leaf) == 0)
        {
          st.playSound(SOUND_FINISH);
          st.exitCurrentQuest(true);
          return "30747_11.htm";
        }
        return "30747_10.htm";
      }
      if(cond == 3)
      {
        if(dragonflute.getObjectId() != dragonflute_id)
        {
          return "30747_00a.htm";
        }
        if(st.getQuestItemsCount(Fairy_Leaf) > 0)
        {
          st.playSound(SOUND_FINISH);
          st.exitCurrentQuest(true);
          return "30747_11.htm";
        }
        if(!(CheckTree(st, Fairy_Tree_of_Wind) && CheckTree(st, Fairy_Tree_of_Star) && CheckTree(st, Fairy_Tree_of_Twilight) && CheckTree(st, Fairy_Tree_of_Abyss)))
        {
          st.playSound(SOUND_FINISH);
          st.exitCurrentQuest(true);
          return "30747_11.htm";
        }
        if(st.getInt("welldone") == 0)
        {
          if(!HatchlingSummoned(st, false))
          {
            return "30747_09.htm";
          }
          st.set("welldone", "1");
          return "30747_12.htm";
        }
        if(HatchlingSummoned(st, false) || st.getPlayer().getPet() != null)
        {
          return "30747_13a.htm";
        }
        dragonflute.setItemId(Dragon_Bugle_of_Wind + dragonflute.getItemId() - Dragonflute_of_Wind);
        dragonflute.updateDatabase(true, true);
        st.getPlayer().sendPacket(new ItemList(st.getPlayer(), false));
        st.playSound(SOUND_FINISH);
        st.exitCurrentQuest(true);
        return "30747_13.htm";
      }
View Full Code Here

    // Create a server->client GetItem packet to pick up the L2ItemInstance
    //player.broadcastPacket(new GetItem((L2ItemInstance) this, player.getObjectId()));
    // if this item is a mercenary ticket, remove the spawns!
    if(isItem())
    {
      L2ItemInstance item = (L2ItemInstance) this;
      int itemId = item.getItemId();
      /*if(itemId >= 3960 && itemId <= 3972 // Gludio
      || itemId >= 3973 && itemId <= 3985 // Dion
      || itemId >= 3986 && itemId <= 3998 // Giran
      || itemId >= 3999 && itemId <= 4011 // Oren
      || itemId >= 4012 && itemId <= 4026 // Aden
      || itemId >= 5205 && itemId <= 5215 // Innadril
      || itemId >= 6779 && itemId <= 6833 // Goddard
      || itemId >= 7973 && itemId <= 8029 // Rune
      || itemId >= 7918 && itemId <= 7972 // Schuttgart
      )*/
      if(itemId >= 3960 && itemId <= 4026 || itemId >= 5205 && itemId <= 5214 || itemId >= 6038 && itemId <= 6306 || itemId >= 6779 && itemId <= 6833 || itemId >= 7918 && itemId <= 8029)
      {
        MercTicketManager.getInstance().removeTicket(item);
      }
      if(target != null && target.isPlayer())
      {
        L2Player player = (L2Player) target;
        if(item.getItem().isCombatFlag() && !FortressSiegeManager.checkIfCanPickup(player))
        {
          return false;
        }
        if(item.getItem().isTerritoryFlag())
        {
          return false;
        }
        if(itemId == 57 || itemId == 6353)
        {
View Full Code Here

    // Go through values of class variable "drops" pointing out mobs that drop for quest
    {
      for(Integer itemId : _quest.getItems())
      {
        // Get [item from] / [presence of the item in] the inventory of the player
        L2ItemInstance item = player.getInventory().getItemByItemId(itemId);
        if(item == null || itemId == 57)
        {
          continue;
        }
        long count = item.getCount();
        // If player has the item in inventory, destroy it (if not gold)
        player.getInventory().destroyItemByItemId(itemId, count, true);
        player.getWarehouse().destroyItem(itemId, count);
      }
    }
View Full Code Here

    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));
View Full Code Here

    {
      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);
    }
View Full Code Here

    if(player == null)
    {
      return 0;
    }
    // Get object item from player's inventory list
    L2ItemInstance item = player.getInventory().getItemByItemId(itemId);
    if(item == null)
    {
      return 0;
    }
    // Tests on count value in order not to have negative value
    if(count < 0 || count > item.getCount())
    {
      count = item.getCount();
    }
    // Destroy the quantity of items wanted
    player.getInventory().destroyItemByItemId(itemId, count, true);
    // Send message of destruction to client
    player.sendPacket(SystemMessage.removeItems(itemId, count));
View Full Code Here

    {
      return;
    }
    if(item.getItemType() == WeaponType.BOW)
    {
      L2ItemInstance arrow = _inv.findArrowForBow(item.getItem());
      if(arrow != null)
      {
        _inv.setPaperdollItem(Inventory.PAPERDOLL_LHAND, arrow);
      }
    }
    if(item.getItemType() == WeaponType.CROSSBOW)
    {
      L2ItemInstance bolt = _inv.findArrowForCrossbow(item.getItem());
      if(bolt != null)
      {
        _inv.setPaperdollItem(Inventory.PAPERDOLL_LHAND, bolt);
      }
    }
    if(item.getItemType() == WeaponType.ROD)
    {
      L2ItemInstance bait = _inv.findEquippedLure();
      if(bait != null)
      {
        _inv.setPaperdollItem(Inventory.PAPERDOLL_LHAND, bait);
      }
    }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.items.L2ItemInstance$LazyUpdateInDb

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.