Package net.sf.l2j.gameserver.model

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


        {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT));
            return;
        }

    L2SummonItem sitem = SummonItemsData.getInstance().getSummonItem(item.getItemId());

    if ((activeChar.getPet() != null || activeChar.isMounted()) && sitem.isPetSummon())
    {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_ALREADY_HAVE_A_PET));
      return;
    }

    if (activeChar.isAttackingNow())
    {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_SUMMON_IN_COMBAT));
      return;
    }

        if (activeChar.isCursedWeaponEquiped() && sitem.isPetSummon())
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.STRIDER_CANT_BE_RIDDEN_WHILE_IN_BATTLE));
          return;
        }

        int npcID = sitem.getNpcId();

        if (npcID == 0)
          return;

    L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(npcID);

        if (npcTemplate == null)
            return;

        switch (sitem.getType())
        {
        case 0: // static summons (like christmas tree)
            try
            {
                L2Spawn spawn = new L2Spawn(npcTemplate);
               
                spawn.setId(IdFactory.getInstance().getNextId());
                spawn.setLocx(activeChar.getX());
                spawn.setLocy(activeChar.getY());
                spawn.setLocz(activeChar.getZ());
                L2World.getInstance().storeObject(spawn.spawnOne());
                activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
                activeChar.sendMessage("Created " + npcTemplate.name + " at x: " + spawn.getLocx() + " y: " + spawn.getLocy() + " z: " + spawn.getLocz());
            }
            catch (Exception e)
            {
                activeChar.sendMessage("Target is not ingame.");
            }

          break;
        case 1: // pet summons
          L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, activeChar, item);

        if (petSummon == null)
          break;

        petSummon.setTitle(activeChar.getName());

        if (!petSummon.isRespawned())
        {
          petSummon.setCurrentHp(petSummon.getMaxHp());
          petSummon.setCurrentMp(petSummon.getMaxMp());
          petSummon.getStat().setExp(petSummon.getExpForThisLevel());
          petSummon.setCurrentFed(petSummon.getMaxFed());
        }

        petSummon.setRunning();

        if (!petSummon.isRespawned())
          petSummon.store();

            activeChar.setPet(petSummon);

        activeChar.sendPacket(new MagicSkillUser(activeChar, 2046, 1, 1000, 600000));
        activeChar.sendPacket(new SystemMessage(SystemMessageId.SUMMON_A_PET));
            L2World.getInstance().storeObject(petSummon);
        petSummon.spawnMe(activeChar.getX()+50, activeChar.getY()+100, activeChar.getZ());
            activeChar.sendPacket(new PetInfo(petSummon));
        petSummon.startFeed(false);
        item.setEnchantLevel(petSummon.getLevel());

        ThreadPoolManager.getInstance().scheduleGeneral(new PetSummonFinalizer(activeChar, petSummon), 900);

        if (petSummon.getCurrentFed() <= 0)
          ThreadPoolManager.getInstance().scheduleGeneral(new PetSummonFeedWait(activeChar, petSummon), 60000);
        else
          petSummon.startFeed(false);

          break;
        case 2: // wyvern
          if(!activeChar.disarmWeapons()) return;
          Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, sitem.getNpcId());
            activeChar.sendPacket(mount);
            activeChar.broadcastPacket(mount);
            activeChar.setMountType(mount.getMountType());
            activeChar.setMountObjectID(item.getObjectId());
        }
View Full Code Here


            }

            if (!ok)
              continue;

            L2SummonItem summonitem = new L2SummonItem(itemID, npcID, summonType);
            _summonitems.put(itemID, summonitem);
        }
       
        _log.warning("Summon items data: Loaded " + _summonitems.size() + " summon items.");
        if (Config.DEBUG)
View Full Code Here

TOP

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

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.