Examples of Territory


Examples of lineage2.gameserver.model.Territory

                if ("coords".equalsIgnoreCase(e2.getName()))
                {
                  coords.add(Location.parseLoc(e2.attributeValue("loc")));
                }
              }
              Territory territory = null;
              if (spawnType == 2)
              {
                Polygon poly = new Polygon();
                for (Location loc : coords)
                {
                  poly.add(loc.x, loc.y).setZmin(loc.z).setZmax(loc.z);
                }
                if (!poly.validate())
                {
                  error("invalid spawn territory for instance id : " + instanceId + " - " + poly + "!");
                }
                territory = new Territory().add(poly);
              }
              for (String mob : mobs)
              {
                mobId = Integer.parseInt(mob);
                spawnDat = new InstantZone.SpawnInfo(spawnType, mobId, count, respawn, respawnRnd, coords, territory);
View Full Code Here

Examples of lineage2.gameserver.model.Territory

              for (int i = 0; i < tokenCount; i++)
              {
                Integer value = Integer.decode(st.nextToken().trim());
                stages[i] = value;
              }
              Territory territory = null;
              for (Node s1 = d1.getFirstChild(); s1 != null; s1 = s1.getNextSibling())
              {
                if ("territory".equalsIgnoreCase(s1.getNodeName()))
                {
                  Polygon poly = new Polygon();
                  for (Node s2 = s1.getFirstChild(); s2 != null; s2 = s2.getNextSibling())
                  {
                    if ("add".equalsIgnoreCase(s2.getNodeName()))
                    {
                      int x = Integer.parseInt(s2.getAttributes().getNamedItem("x").getNodeValue());
                      int y = Integer.parseInt(s2.getAttributes().getNamedItem("y").getNodeValue());
                      int minZ = Integer.parseInt(s2.getAttributes().getNamedItem("zmin").getNodeValue());
                      int maxZ = Integer.parseInt(s2.getAttributes().getNamedItem("zmax").getNodeValue());
                      poly.add(x, y).setZmin(minZ).setZmax(maxZ);
                    }
                  }
                  territory = new Territory().add(poly);
                  if (!poly.validate())
                  {
                    _log.error("HellboundManager: Invalid spawn territory : " + poly + "!");
                    continue;
                  }
View Full Code Here

Examples of lineage2.gameserver.model.Territory

      Element zoneElement = iterator.next();
      if ("zone".equals(zoneElement.getName()))
      {
        zoneDat.set("name", zoneElement.attribute("name").getValue());
        zoneDat.set("type", zoneElement.attribute("type").getValue());
        Territory territory = null;
        boolean isShape;
        for (Iterator<Element> i = zoneElement.elementIterator(); i.hasNext();)
        {
          Element n = i.next();
          if ("set".equals(n.getName()))
          {
            zoneDat.set(n.attributeValue("name"), n.attributeValue("val"));
          }
          else if ("restart_point".equals(n.getName()))
          {
            List<Location> restartPoints = new ArrayList<>();
            for (Iterator<?> ii = n.elementIterator(); ii.hasNext();)
            {
              Element d = (Element) ii.next();
              if ("coords".equalsIgnoreCase(d.getName()))
              {
                Location loc = Location.parseLoc(d.attribute("loc").getValue());
                restartPoints.add(loc);
              }
            }
            zoneDat.set("restart_points", restartPoints);
          }
          else if ("PKrestart_point".equals(n.getName()))
          {
            List<Location> PKrestartPoints = new ArrayList<>();
            for (Iterator<?> ii = n.elementIterator(); ii.hasNext();)
            {
              Element d = (Element) ii.next();
              if ("coords".equalsIgnoreCase(d.getName()))
              {
                Location loc = Location.parseLoc(d.attribute("loc").getValue());
                PKrestartPoints.add(loc);
              }
            }
            zoneDat.set("PKrestart_points", PKrestartPoints);
          }
          else if ((isShape = "rectangle".equalsIgnoreCase(n.getName())) || "banned_rectangle".equalsIgnoreCase(n.getName()))
          {
            Shape shape = parseRectangle(n);
            if (territory == null)
            {
              territory = new Territory();
              zoneDat.set("territory", territory);
            }
            if (isShape)
            {
              territory.add(shape);
            }
            else
            {
              territory.addBanned(shape);
            }
          }
          else if ((isShape = "circle".equalsIgnoreCase(n.getName())) || "banned_cicrcle".equalsIgnoreCase(n.getName()))
          {
            Shape shape = parseCircle(n);
            if (territory == null)
            {
              territory = new Territory();
              zoneDat.set("territory", territory);
            }
            if (isShape)
            {
              territory.add(shape);
            }
            else
            {
              territory.addBanned(shape);
            }
          }
          else if ((isShape = "polygon".equalsIgnoreCase(n.getName())) || "banned_polygon".equalsIgnoreCase(n.getName()))
          {
            Polygon shape = parsePolygon(n);
            if (!shape.validate())
            {
              error("ZoneParser: invalid territory data : " + shape + ", zone: " + zoneDat.getString("name") + "!");
            }
            if (territory == null)
            {
              territory = new Territory();
              zoneDat.set("territory", territory);
            }
            if (isShape)
            {
              territory.add(shape);
            }
            else
            {
              territory.addBanned(shape);
            }
          }
        }
        if ((territory == null) || territory.getTerritories().isEmpty())
        {
          error("Empty territory for zone: " + zoneDat.get("name"));
        }
        ZoneTemplate template = new ZoneTemplate(zoneDat);
        getHolder().addTemplate(template);
View Full Code Here

Examples of lineage2.gameserver.model.Territory

    for (Iterator<Element> iterator = rootElement.elementIterator(); iterator.hasNext();)
    {
      Element listElement = iterator.next();
      if ("restart_area".equals(listElement.getName()))
      {
        Territory territory = null;
        Map<Race, String> restarts = new HashMap<>();
        for (Iterator<Element> i = listElement.elementIterator(); i.hasNext();)
        {
          Element n = i.next();
          if ("region".equalsIgnoreCase(n.getName()))
          {
            Rectangle shape;
            Attribute map = n.attribute("map");
            String s = map.getValue();
            String val[] = s.split("_");
            int rx = Integer.parseInt(val[0]);
            int ry = Integer.parseInt(val[1]);
            int x1 = World.MAP_MIN_X + ((rx - Config.GEO_X_FIRST) << 15);
            int y1 = World.MAP_MIN_Y + ((ry - Config.GEO_Y_FIRST) << 15);
            int x2 = (x1 + (1 << 15)) - 1;
            int y2 = (y1 + (1 << 15)) - 1;
            shape = new Rectangle(x1, y1, x2, y2);
            shape.setZmin(World.MAP_MIN_Z);
            shape.setZmax(World.MAP_MAX_Z);
            if (territory == null)
            {
              territory = new Territory();
            }
            territory.add(shape);
          }
          else if ("polygon".equalsIgnoreCase(n.getName()))
          {
            Polygon shape = ZoneParser.parsePolygon(n);
            if (!shape.validate())
            {
              error("RestartPointParser: invalid territory data : " + shape + "!");
            }
            if (territory == null)
            {
              territory = new Territory();
            }
            territory.add(shape);
          }
          else if ("restart".equalsIgnoreCase(n.getName()))
          {
            Race race = Race.valueOf(n.attributeValue("race"));
            String locName = n.attributeValue("loc");
View Full Code Here

Examples of lineage2.gameserver.model.Territory

                {
                  attrs = room.getAttributes();
                  roomId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
                  Node boss = attrs.getNamedItem("isBossRoom");
                  isBossRoom = (boss != null) && Boolean.parseBoolean(boss.getNodeValue());
                  Territory territory = null;
                  for (Node coord = room.getFirstChild(); coord != null; coord = coord.getNextSibling())
                  {
                    if ("teleport".equalsIgnoreCase(coord.getNodeName()))
                    {
                      attrs = coord.getAttributes();
                      tele = Location.parseLoc(attrs.getNamedItem("loc").getNodeValue());
                    }
                    else if ("zone".equalsIgnoreCase(coord.getNodeName()))
                    {
                      attrs = coord.getAttributes();
                      xMin = Integer.parseInt(attrs.getNamedItem("xMin").getNodeValue());
                      xMax = Integer.parseInt(attrs.getNamedItem("xMax").getNodeValue());
                      yMin = Integer.parseInt(attrs.getNamedItem("yMin").getNodeValue());
                      yMax = Integer.parseInt(attrs.getNamedItem("yMax").getNodeValue());
                      zMin = Integer.parseInt(attrs.getNamedItem("zMin").getNodeValue());
                      zMax = Integer.parseInt(attrs.getNamedItem("zMax").getNodeValue());
                      territory = new Territory().add(new Rectangle(xMin, yMin, xMax, yMax).setZmin(zMin).setZmax(zMax));
                    }
                  }
                  if (territory == null)
                  {
                    _log.error("DimensionalRiftManager: invalid spawn data for room id " + roomId + "!");
View Full Code Here

Examples of lineage2.gameserver.model.Territory

    {
      Element spawnElement = spawnIterator.next();
      if (spawnElement.getName().equalsIgnoreCase("territory"))
      {
        String terName = spawnElement.attributeValue("name");
        Territory territory = parseTerritory(terName, spawnElement);
        territories.put(terName, territory);
      }
      else if (spawnElement.getName().equalsIgnoreCase("spawn"))
      {
        String group = spawnElement.attributeValue("group");
        int respawn = spawnElement.attributeValue("respawn") == null ? 60 : Integer.parseInt(spawnElement.attributeValue("respawn"));
        int respawnRandom = spawnElement.attributeValue("respawn_random") == null ? 0 : Integer.parseInt(spawnElement.attributeValue("respawn_random"));
        int count = spawnElement.attributeValue("count") == null ? 1 : Integer.parseInt(spawnElement.attributeValue("count"));
        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"))
          {
View Full Code Here

Examples of lineage2.gameserver.model.Territory

   * @param e Element
   * @return Territory
   */
  private Territory parseTerritory(String name, Element e)
  {
    Territory t = new Territory();
    t.add(parsePolygon0(name, e));
    for (Iterator<Element> iterator = e.elementIterator("banned_territory"); iterator.hasNext();)
    {
      t.addBanned(parsePolygon0(name, iterator.next()));
    }
    return t;
  }
View Full Code Here

Examples of lineage2.gameserver.model.Territory

    {
      Element listElement = iterator.next();
      if ("domain".equals(listElement.getName()))
      {
        int id = Integer.parseInt(listElement.attributeValue("id"));
        Territory territory = null;
        for (Iterator<Element> i = listElement.elementIterator(); i.hasNext();)
        {
          Element n = i.next();
          if ("polygon".equalsIgnoreCase(n.getName()))
          {
            Polygon shape = ZoneParser.parsePolygon(n);
            if (!shape.validate())
            {
              error("DomainParser: invalid territory data : " + shape + "!");
            }
            if (territory == null)
            {
              territory = new Territory();
            }
            territory.add(shape);
          }
        }
        if (territory == null)
        {
          throw new RuntimeException("DomainParser: empty territory!");
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.