Package lineage2.gameserver.model

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


    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

                {
                  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

    {
      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

   * @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

    {
      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

    _zoneListener = new ZoneListener();
    for (String element : ZONES)
    {
      int random = Rnd.get(60 * 1000 * 1, 60 * 1000 * 7);
      int message;
      Zone zone = ReflectionUtils.getZone(element);
      ThreadPoolManager.getInstance().schedule(new CampDestroyTask(zone), random);
      if (random > (5 * 60000))
      {
        message = random - (5 * 60000);
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(0, zone), message);
      }
      if (random > (3 * 60000))
      {
        message = random - (3 * 60000);
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(0, zone), message);
      }
      if (random > 60000)
      {
        message = random - 60000;
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(0, zone), message);
      }
      if (random > 15000)
      {
        message = random - 15000;
        ThreadPoolManager.getInstance().schedule(new BroadcastMessageTask(1, zone), message);
      }
      zone.addListener(_zoneListener);
    }
    _buffTask = ThreadPoolManager.getInstance().scheduleAtFixedRate(new BuffTask(), TICK_BUFF_DELAY, TICK_BUFF_DELAY);
  }
View Full Code Here

  @Override
  public void onReload()
  {
    for (String element : ZONES)
    {
      Zone zone = ReflectionUtils.getZone(element);
      zone.removeListener(_zoneListener);
    }
    if (_buffTask != null)
    {
      _buffTask.cancel(false);
      _buffTask = null;
View Full Code Here

    @Override
    public void runImpl()
    {
      for (String element : ZONES)
      {
        Zone zone = ReflectionUtils.getZone(element);
        NpcInstance npc = getKasha(zone);
        if ((npc != null) && (zone != null))
        {
          int curseLvl = 0;
          int yearningLvl = 0;
          int despairLvl = 0;
          for (Creature c : zone.getObjects())
          {
            if (c.isMonster() && !c.isDead())
            {
              if (getRealNpcId((NpcInstance) c) == mobs[0])
              {
                curseLvl++;
              }
              else if (getRealNpcId((NpcInstance) c) == mobs[1])
              {
                yearningLvl++;
              }
              else if (getRealNpcId((NpcInstance) c) == mobs[2])
              {
                despairLvl++;
              }
            }
          }
          if ((yearningLvl > 0) || (curseLvl > 0) || (despairLvl > 0))
          {
            for (Creature cha : zone.getInsidePlayables())
            {
              boolean casted = false;
              if (curseLvl > 0)
              {
                addEffect(npc, cha.getPlayer(), SkillTable.getInstance().getInfo(_buffs[0], curseLvl), true);
View Full Code Here

  private void init()
  {
    _zoneListener = new ZoneListener();
    for (String s : zones)
    {
      Zone zone = ReflectionUtils.getZone(s);
      zone.addListener(_zoneListener);
    }
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.Territory

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.