Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2ItemInstance


        int i = 0;
        for (L2PcInstance player : knownPlayers)
        {
          if(player.isInBoat())
          {
          L2ItemInstance it;
          it = player.getInventory().getItemByItemId(_t1.idWTicket1);
          if((it != null)&&(it.getCount() >= 1))
          {
            player.getInventory().destroyItem("Boat", it.getObjectId(), 1, player, this);
            InventoryUpdate iu = new InventoryUpdate();
            iu.addModifiedItem(it);
            player.sendPacket(iu);
            _inboat.put(i,player);
            i++;
          }
          else if (it == null && _t1.idWTicket1 == 0)
          {
            _inboat.put(i,player);
            i++;
          }
          else
          {
            player.teleToLocation(_t1.ntx1,_t1.nty1,_t1.ntz1, false);
          }
          }
        }
      }
      Boatrun bc = new Boatrun(0,this);
      ThreadPoolManager.getInstance().scheduleGeneral(bc, 0);
    }
    else if(_cycle == 2)
    {
      Collection<L2PcInstance> knownPlayers = getKnownList().getKnownPlayers().values();
      if (knownPlayers != null && !knownPlayers.isEmpty())
      {
        _inboat = new FastMap<Integer,L2PcInstance>();
        int i = 0;
        for (L2PcInstance player : knownPlayers)
        {
          if(player.isInBoat())
          {
          L2ItemInstance it;
          it = player.getInventory().getItemByItemId(_t2.idWTicket1);
          if((it != null)&&(it.getCount() >= 1))
          {

            player.getInventory().destroyItem("Boat", it.getObjectId(), 1, player, this);
            InventoryUpdate iu = new InventoryUpdate();
            iu.addModifiedItem(it);
            player.sendPacket(iu);
            _inboat.put(i,player);
            i++;
View Full Code Here


                    if (player.getObjectId() != prevParticipants.get(0).getObjectId()) {
                        showChatWindow(player, 3, "b", false);
                        return;
                    }

                    L2ItemInstance bloodOfferings = player.getInventory().getItemByItemId(SevenSignsFestival.FESTIVAL_OFFERING_ID);
                    int offeringCount = 0;

                    // Check if the player collected any blood offerings during the festival.
                    if (bloodOfferings == null) {
                        player.sendMessage("You do not have any blood offerings to contribute.");
                        return;
                    }

                    offeringCount = bloodOfferings.getCount();

                    int offeringScore = offeringCount * SevenSignsFestival.FESTIVAL_OFFERING_VALUE;
                    boolean isHighestScore = SevenSignsFestival.getInstance().setFinalScore(player, _festivalOracle, _festivalType, offeringScore);

                    player.destroyItem("SevenSigns", bloodOfferings, this, false);
View Full Code Here

        Castle castle = CastleManager.getInstance().getCastle(player);
        if (castle == null || !checkIfOkToUseStriderSiegeAssault(player, castle, true)) return;

        try
        {
            L2ItemInstance itemToTake = player.getInventory().getItemByItemId(skill.getItemConsumeId());
            if(!player.destroyItem("Consume", itemToTake.getObjectId(), skill.getItemConsume(), null, true))
              return;

            // damage calculation
            int damage = 0;

            for(int index = 0;index < targets.length;index++)
            {
                L2Character target = (L2Character)targets[index];
                L2ItemInstance weapon = activeChar.getActiveWeaponInstance();
                if (activeChar instanceof L2PcInstance && target instanceof L2PcInstance &&
                    target.isAlikeDead() && target.isFakeDeath())
                {
                  target.stopFakeDeath(null);
                }
                else if (target.isAlikeDead())
                    continue;

                boolean dual  = activeChar.isUsingDualWeapon();
                boolean shld = Formulas.getInstance().calcShldUse(activeChar, target);
                boolean crit = Formulas.getInstance().calcCrit(activeChar.getCriticalHit(target, skill));
                boolean soul = (weapon!= null && weapon.getChargedSoulshot() == L2ItemInstance.CHARGED_SOULSHOT && weapon.getItemType() != L2WeaponType.DAGGER );

                if(!crit && (skill.getCondition() & L2Skill.COND_CRIT) != 0)
                  damage = 0;
                else
                  damage = (int)Formulas.getInstance().calcPhysDam(
                  activeChar, target, skill, shld, crit, dual, soul);

                if (damage > 0)
                {
                  target.reduceCurrentHp(damage, activeChar);
                  if (soul && weapon!= null)
                    weapon.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);

                  activeChar.sendDamageMessage(target, damage, false, false, false);

                }
                else activeChar.sendPacket(SystemMessage.sendString(skill.getName() + " failed."));
View Full Code Here

            sm = new SystemMessage(SystemMessageId.ACQUIRED);
            sm.addNumber(lotonumber);
            sm.addItemName(4442);
            player.sendPacket(sm);
           
            L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), 4442);
      item.setCount(1);
      item.setCustomType1(lotonumber);
      item.setEnchantLevel(enchant);
      item.setCustomType2(type2);
      player.getInventory().addItem("Loto", item, player, this);
     
      InventoryUpdate iu = new InventoryUpdate();
      iu.addItem(item);
      L2ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
      iu.addModifiedItem(adenaupdate);
      player.sendPacket(iu);
           
            filename = (getHtmlPath(npcId, 3));
            html.setFile(filename);
        }
        else if (val == 23) //23 - current lottery jackpot
        {
            filename = (getHtmlPath(npcId, 3));
            html.setFile(filename);
        }
        else if (val == 24) // 24 - Previous winning numbers/Prize claim
        {
            filename = (getHtmlPath(npcId, 4));
            html.setFile(filename);
           
            int lotonumber = Lottery.getInstance().getId();
            String message = "";
            for (L2ItemInstance item : player.getInventory().getItems())
            {
                if (item == null) continue;
                if (item.getItemId() == 4442 && item.getCustomType1() < lotonumber)
                {
                    message = message + "<a action=\"bypass -h npc_%objectId%_Loto "
                    + item.getObjectId() + "\">" + item.getCustomType1() + " Event Number ";
                    int[] numbers = Lottery.getInstance().decodeNumbers(item.getEnchantLevel(),
                                                                        item.getCustomType2());
                    for (int i = 0; i < 5; i++)
                    {
                        message += numbers[i] + " ";
                    }
                    int[] check = Lottery.getInstance().checkTicket(item);
                    if (check[0] > 0)
                    {
                        switch (check[0])
                        {
                            case 1:
                                message += "- 1st Prize";
                                break;
                            case 2:
                                message += "- 2nd Prize";
                                break;
                            case 3:
                                message += "- 3th Prize";
                                break;
                            case 4:
                                message += "- 4th Prize";
                                break;
                        }
                        message += " " + check[1] + "a.";
                    }
                    message += "</a><br>";
                }
            }
            if (message == "")
            {
                message += "There is no winning lottery ticket...<br>";
            }
            html.replace("%result%", message);
        }
        else if (val > 24) // >24 - check lottery ticket by item object id
        {
            int lotonumber = Lottery.getInstance().getId();
            L2ItemInstance item = player.getInventory().getItemByObjectId(val);
            if (item == null || item.getItemId() != 4442 || item.getCustomType1() >= lotonumber) return;
            int[] check = Lottery.getInstance().checkTicket(item);
           
            sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM);
            sm.addItemName(4442);
            player.sendPacket(sm);
View Full Code Here

                     for (L2Attackable.RewardItem ritem : items) {
                         cropId = ritem.getItemId(); // always got 1 type of crop as reward
                         if (_activeChar.isInParty())
                           _activeChar.getParty().distributeItem(_activeChar, ritem, true, _target);
                         else {
                             L2ItemInstance item = _activeChar.getInventory().addItem("Manor", ritem.getItemId(), ritem.getCount(), _activeChar, _target);
                             if (iu != null) iu.addItem(item);
                             send = true;
                             total += ritem.getCount();
                         }
                     }
View Full Code Here

        {
          if (player.isInParty())
            player.getParty().distributeItem(player, ritem, true, target);
          else
          {
            L2ItemInstance item = player.getInventory().addItem("Sweep", ritem.getItemId(), ritem.getCount(), player, target);
            if (iu != null) iu.addItem(item);
            send = true;

            SystemMessage smsg;
            if (ritem.getCount() > 1)
View Full Code Here

          if (_seedId == 0) {
            _activeChar.sendPacket(new ActionFailed());
              continue;
          }

          L2ItemInstance item = _activeChar.getInventory().getItemByItemId(_seedId);
          //Consuming used seed
        _activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);

        SystemMessage sm = null;
        if (calcSuccess()) {
            _activeChar.sendPacket(new PlaySound("Itemsound.quest_itemget"));
              _target.setSeeded();
View Full Code Here

        boolean ss = false;
        boolean sps = false;
        boolean bss = false;

        L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();

        if (weaponInst != null)
        {
          if (skill.isMagic())
          {
              if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
              {
                  bss = true;
              }
              else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
              {
                  sps = true;
              }
          }
            else
              if (weaponInst.getChargedSoulshot() == L2ItemInstance.CHARGED_SOULSHOT)
              {
                  ss = true;
              }
        }
        // If there is no weapon equipped, check for an active summon.
View Full Code Here

    ItemTable itemTable = ItemTable.getInstance();
    L2Item[] items = template.getItems();
    for (int i = 0; i < items.length; i++)
    {
      L2ItemInstance item = newChar.getInventory().addItem("Init", items[i].getItemId(), 1, newChar, null);
      if (item.getItemId()==5588){
          //add tutbook shortcut
          shortcut = new L2ShortCut(11,0,1,item.getObjectId(),-1,1);
          newChar.registerShortCut(shortcut);
      }
      if (item.isEquipable()){
        if (newChar.getActiveWeaponItem() == null || !(item.getItem().getType2() != L2Item.TYPE2_WEAPON))
          newChar.getInventory().equipItemAndRecord(item);
      }
    }

    L2SkillLearn[] startSkills = SkillTreeTable.getInstance().getAvailableSkills(newChar, newChar.getClassId());
View Full Code Here

    _castleCrops = new FastMap<Integer, CropProcure>();
    _cropsItems = new FastMap<Integer, L2ItemInstance>();

    FastList<Integer> allCrops = L2Manor.getInstance().getAllCrops();
    for(int cropId : allCrops) {
            L2ItemInstance item = player.getInventory().getItemByItemId(cropId);
            if(item != null) {
                _cropsItems.put(cropId, item);
            }
        }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2ItemInstance

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.