Examples of SpawnTemplate


Examples of lineage2.gameserver.templates.spawn.SpawnTemplate

    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT * FROM spawnlist ORDER by npc_templateid");
      rset = statement.executeQuery();
      SpawnTemplate template;
      while (rset.next())
      {
        int count = rset.getInt("count");
        int delay = rset.getInt("respawn_delay");
        int delay_rnd = rset.getInt("respawn_delay_rnd");
        int npcId = rset.getInt("npc_templateid");
        int x = rset.getInt("locx");
        int y = rset.getInt("locy");
        int z = rset.getInt("locz");
        int h = rset.getInt("heading");
        template = new SpawnTemplate(PeriodOfDay.NONE, count, delay, delay_rnd);
        template.addNpc(new SpawnNpcInfo(npcId, 1, StatsSet.EMPTY));
        template.addSpawnRange(new Location(x, y, z, h));
        SpawnHolder.getInstance().addSpawn(PeriodOfDay.NONE.name(), template);
      }
    }
    catch (Exception e1)
    {
View Full Code Here

Examples of lineage2.gameserver.templates.spawn.SpawnTemplate

    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT * FROM custom_spawnlist ORDER by npc_templateid");
      rset = statement.executeQuery();
      SpawnTemplate template;
      while (rset.next())
      {
        int count = rset.getInt("count");
        int delay = rset.getInt("respawn_delay");
        int delay_rnd = rset.getInt("respawn_delay_rnd");
        int npcId = rset.getInt("npc_templateid");
        int x = rset.getInt("locx");
        int y = rset.getInt("locy");
        int z = rset.getInt("locz");
        int h = rset.getInt("heading");
        template = new SpawnTemplate(PeriodOfDay.NONE, count, delay, delay_rnd);
        template.addNpc(new SpawnNpcInfo(npcId, 1, StatsSet.EMPTY));
        template.addSpawnRange(new Location(x, y, z, h));
        SpawnHolder.getInstance().addSpawn(PeriodOfDay.NONE.name(), template);
      }
    }
    catch (Exception e1)
    {
View Full Code Here

Examples of lineage2.gameserver.templates.spawn.SpawnTemplate

        PeriodOfDay periodOfDay = spawnElement.attributeValue("period_of_day") == null ? PeriodOfDay.NONE : PeriodOfDay.valueOf(spawnElement.attributeValue("period_of_day").toUpperCase());
        if (group == null)
        {
          group = periodOfDay.name();
        }
        SpawnTemplate template = new SpawnTemplate(periodOfDay, count, respawn, respawnRandom);
        for (Iterator<Element> subIterator = spawnElement.elementIterator(); subIterator.hasNext();)
        {
          Element subElement = subIterator.next();
          if (subElement.getName().equalsIgnoreCase("point"))
          {
            int x = Integer.parseInt(subElement.attributeValue("x"));
            int y = Integer.parseInt(subElement.attributeValue("y"));
            int z = Integer.parseInt(subElement.attributeValue("z"));
            int h = subElement.attributeValue("h") == null ? -1 : Integer.parseInt(subElement.attributeValue("h"));
            template.addSpawnRange(new Location(x, y, z, h));
          }
          else if (subElement.getName().equalsIgnoreCase("territory"))
          {
            String terName = subElement.attributeValue("name");
            if (terName != null)
            {
              Territory g = territories.get(terName);
              if (g == null)
              {
                error("Invalid territory name: " + terName + "; " + getCurrentFileName());
                continue;
              }
              template.addSpawnRange(g);
            }
            else
            {
              Territory temp = parseTerritory(null, subElement);
              template.addSpawnRange(temp);
            }
          }
          else if (subElement.getName().equalsIgnoreCase("npc"))
          {
            int npcId = Integer.parseInt(subElement.attributeValue("id"));
            int max = subElement.attributeValue("max") == null ? 0 : Integer.parseInt(subElement.attributeValue("max"));
            MultiValueSet<String> parameters = StatsSet.EMPTY;
            for (Element e : subElement.elements())
            {
              if (parameters.isEmpty())
              {
                parameters = new MultiValueSet<>();
              }
              parameters.set(e.attributeValue("name"), e.attributeValue("value"));
            }
            template.addNpc(new SpawnNpcInfo(npcId, max, parameters));
          }
        }
        if (template.getNpcSize() == 0)
        {
          warn("Npc id is zero! File: " + getCurrentFileName());
          continue;
        }
        if (template.getSpawnRangeSize() == 0)
        {
          warn("No points to spawn! File: " + getCurrentFileName());
          continue;
        }
        getHolder().addSpawn(group, template);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.