Package com.l2jfrozen.gameserver.model

Examples of com.l2jfrozen.gameserver.model.L2SummonItem


        if(!ok)
        {
          continue;
        }

        L2SummonItem summonitem = new L2SummonItem(itemID, npcID, summonType);
        _summonitems.put(itemID, summonitem);
        summonitem = null;
      }

    }
View Full Code Here


    {
      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;
    }
   
    // Like L2OFF you can't summon pet in combat
    if (activeChar.isAttackingNow() || activeChar.isInCombat())
    {
      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);
         
          // if(spawn == null)
          // return;
         
          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());
          spawn = null;
        }
        catch (Exception e)
        {
          if (Config.ENABLE_ALL_EXCEPTIONS)
            e.printStackTrace();
         
          activeChar.sendMessage("Target is not ingame.");
        }
       
        break;
      case 1: // pet summons
        activeChar.setTarget(activeChar);
        // Skill 2046 used only for animation
        L2Skill skill = SkillTable.getInstance().getInfo(2046, 1);
        activeChar.useMagic(skill, true, true);
        activeChar.sendPacket(new SystemMessage(SystemMessageId.SUMMON_A_PET));
        ThreadPoolManager.getInstance().scheduleGeneral(new PetSummonFinalizer(activeChar, npcTemplate, item), 4800);
       
        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

TOP

Related Classes of com.l2jfrozen.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.