Package net.sf.l2j.gameserver.templates

Examples of net.sf.l2j.gameserver.templates.L2NpcTemplate


        if ((obj != null) && (obj instanceof L2NpcInstance))
        {
            L2NpcInstance target = (L2NpcInstance) obj;

            int monsterTemplate = target.getTemplate().npcId;
            L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(monsterTemplate);
            if (template1 == null)
            {
                activeChar.sendMessage("Incorrect monster template.");
                _log.warning("ERROR: NPC " + target.getObjectId() + " has a 'null' template.");
                return;
View Full Code Here


   *
   * @return boolean<br>
   */
  public static boolean startParticipation()
  {
    L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(Config.TVT_EVENT_PARTICIPATION_NPC_ID);

    if (tmpl == null)
    {
      System.out.println("TvTEventEngine[TvTEvent.startParticipation()]: L2NpcTemplate is a NullPointer -> Invalid npc id in configs?");
      return false;
View Full Code Here

        int npcID = sitem.getNpcId();

        if (npcID == 0)
          return;

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

        if (npcTemplate == null)
            return;

        switch (sitem.getType())
View Full Code Here

            Document doc = factory.newDocumentBuilder().parse(file);
            NamedNodeMap attrs;
            byte type, roomId;
            int mobId, x, y, z, delay, count;
            L2Spawn spawnDat;
            L2NpcTemplate template;

            for (Node rift = doc.getFirstChild(); rift != null; rift = rift.getNextSibling())
            {
                if ("rift".equalsIgnoreCase(rift.getNodeName()))
                {
View Full Code Here

    @Override
  public void useItem(L2PlayableInstance playable, L2ItemInstance item)
    {
        L2PcInstance activeChar = (L2PcInstance)playable;
        L2NpcTemplate template1 = null;

        int itemId = item.getItemId();
        for (int i = 0; i < ITEM_IDS.length; i++)
        {
            if (ITEM_IDS[i] == itemId)
View Full Code Here

            else
                statement.setInt(2, 0);
            ResultSet rs = statement.executeQuery();

            L2Spawn spawn1;
            L2NpcTemplate template1;

            while (rs.next())
            {
                template1 = NpcTable.getInstance().getTemplate(rs.getInt("npcId"));
                if (template1 != null)
View Full Code Here

        final int y = locationList[locationIndex].getY();
        final int z = locationList[locationIndex].getZ();
        final int heading = locationList[locationIndex].getHeading();

        // Fetch the template for this NPC ID and create a new spawn.
        L2NpcTemplate npcTemp = NpcTable.getInstance().getTemplate(spawnInst.getNpcId());
        if (npcTemp == null)
        {
          _log.warning("Couldnt find NPC id" + spawnInst.getNpcId()+ " Try to update your DP");
          return;
        }
View Full Code Here

      if (s.equals("lvl2")) { lvl2 = Integer.parseInt(st.nextToken()); continue; }
      if (s.equals("mid1")) { mid1 = Integer.parseInt(st.nextToken()); continue; }
      if (s.equals("mid2")) { mid2 = Integer.parseInt(st.nextToken()); continue; }
    }

    L2NpcTemplate npc1 = null;
    if (mid1 != 0)
      npc1 = NpcTable.getInstance().getTemplate(mid1);
    L2NpcTemplate npc2 = null;
    if (mid2 != 0)
      npc2 = NpcTable.getInstance().getTemplate(mid2);


    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
View Full Code Here

    {
      try
      {
        String[] commandSplit = command.split(" ");
        int npcId = Integer.valueOf(commandSplit[1]);
        L2NpcTemplate npc = NpcTable.getInstance().getTemplate(npcId);
        Show_Npc_Property(activeChar, npc);
      }
      catch (Exception e)
      {
        activeChar.sendMessage("Wrong usage: //edit_npc <npcId>");
      }
    }
    else if(command.startsWith("admin_show_droplist "))
    {
      int npcId = 0;
      try
      {
        npcId = Integer.parseInt(command.substring(20).trim());
      }
      catch(Exception e){}

      if(npcId > 0)
        showNpcDropList(activeChar, npcId);
      else
        activeChar.sendMessage("Usage: //show_droplist <npc_id>");
    }
    else if (!Config.ALT_PRIVILEGES_ADMIN && !(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM()))
      return false;
    else if(command.startsWith("admin_addShopItem "))
    {
      String[] args = command.split(" ");
      if (args.length > 1)
        addShopItem(activeChar, args);
    }
    else if(command.startsWith("admin_delShopItem "))
    {
      String[] args = command.split(" ");
      if (args.length > 2)
        delShopItem(activeChar, args);
    }
    else if(command.startsWith("admin_editShopItem "))
    {
      String[] args = command.split(" ");
      if (args.length > 2)
        editShopItem(activeChar, args);
    }
    else if(command.startsWith("admin_save_npc "))
    {
      try
      {
        save_npc_property(activeChar, command);
      }
      catch (StringIndexOutOfBoundsException e)
      {}
    }
    else if(command.startsWith("admin_edit_drop "))
    {
      int npcId = -1, itemId = 0, category = -1000;
      try
      {
        StringTokenizer st = new StringTokenizer(command.substring(16).trim());
        if (st.countTokens() == 3)
        {
          try
          {
            npcId = Integer.parseInt(st.nextToken());
            itemId = Integer.parseInt(st.nextToken());
            category = Integer.parseInt(st.nextToken());
            showEditDropData(activeChar, npcId, itemId, category);
          }
          catch(Exception e)
          {}
        }
        else if (st.countTokens() == 6)
        {
          try
          {
            npcId = Integer.parseInt(st.nextToken());
            itemId = Integer.parseInt(st.nextToken());
            category = Integer.parseInt(st.nextToken());
            int min = Integer.parseInt(st.nextToken());
            int max = Integer.parseInt(st.nextToken());
            int chance = Integer.parseInt(st.nextToken());

            updateDropData(activeChar, npcId, itemId, min, max, category, chance);
          }
          catch(Exception e)
          {
            _log.fine("admin_edit_drop parements error: " + command);
          }
        }
        else
          activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance>]");
      }
      catch (StringIndexOutOfBoundsException e)
      {
        activeChar.sendMessage("Usage: //edit_drop <npc_id> <item_id> <category> [<min> <max> <chance>]");
      }
    }
    else if (command.startsWith("admin_add_drop "))
    {
      int npcId = -1;
      try
      {
        StringTokenizer st = new StringTokenizer(command.substring(15).trim());
        if(st.countTokens() == 1)
        {
          try
          {
            String[] input = command.substring(15).split(" ");
            if (input.length < 1)
              return true;
            npcId = Integer.parseInt(input[0]);
          }
          catch(Exception e){}

          if(npcId > 0)
          {
            L2NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);
            showAddDropData(activeChar, npcData);
          }
        }
        else if(st.countTokens() == 6)
        {
View Full Code Here

    Show_Npc_Property(activeChar, NpcTable.getInstance().getTemplate(npcId));
  }

  private void showNpcDropList(L2PcInstance activeChar, int npcId)
  {
    L2NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);
    if(npcData == null)
    {
      activeChar.sendMessage("unknown npc template id" + npcId);
      return ;
    }

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    TextBuilder replyMSG = new TextBuilder("<html><title>NPC: "+ npcData.name + "("+npcData.npcId+") 's drop manage</title>");
    replyMSG.append("<body>");
    replyMSG.append("<br>Notes: click[drop_id]to show the detail of drop data,click[del] to delete the drop data!");
    replyMSG.append("<table>");
    replyMSG.append("<tr><td>npc_id itemId category</td><td>item[id]</td><td>type</td><td>del</td></tr>");

    for(L2DropCategory cat:npcData.getDropData())
      for(L2DropData drop : cat.getAllDrops())
      {
        replyMSG.append("<tr><td><a action=\"bypass -h admin_edit_drop " + npcData.npcId + " " + drop.getItemId()+ " " + cat.getCategoryType() + "\">"
            + npcData.npcId + " " + drop.getItemId() + " " + cat.getCategoryType() + "</a></td>" +
            "<td>" + ItemTable.getInstance().getTemplate(drop.getItemId()).getName() + "[" + drop.getItemId() + "]" + "</td><td>" + (drop.isQuestDrop()?"Q":(cat.isSweep()?"S":"D")) + "</td><td>" +
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.templates.L2NpcTemplate

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.