Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Spawn


    {
      FestivalSpawn currSpawn = new FestivalSpawn(element);
      L2NpcTemplate npcTemplate = NpcTable.getTemplate(currSpawn.npcId);
      try
      {
        L2Spawn npcSpawn = new L2Spawn(npcTemplate);
        npcSpawn.setReflection(_id);
        npcSpawn.setLoc(currSpawn.loc);
        npcSpawn.setHeading(Rnd.get(65536));
        npcSpawn.setAmount(1);
        npcSpawn.setRespawnDelay(respawnDelay);
        npcSpawn.startRespawn();
        L2FestivalMonsterInstance festivalMob = (L2FestivalMonsterInstance) npcSpawn.doSpawn(true);
        // Set the offering bonus to 2x or 5x the amount per kill, if this spawn is part of an increased challenge or is a festival chest.
        if(spawnType == 1)
        {
          festivalMob.setOfferingBonus(2);
        }
View Full Code Here


      boolean dispellBuffs;
      Integer roomId;
      int mobId, doorId, respawn, respawnRnd, count;
      // 0 - точечный, в каждой указанной точке; 1 - один точечный спаун в рандомной точке; 2 - локационный
      int spawnType;
      L2Spawn spawnDat;
      L2NpcTemplate template;
      L2DoorInstance door;
      InstancedZone instancedZone;
      for(Node iz = doc.getFirstChild(); iz != null; iz = iz.getNextSibling())
      {
        if("list".equalsIgnoreCase(iz.getNodeName()))
        {
          for(Node area = iz.getFirstChild(); area != null; area = area.getNextSibling())
          {
            if("instance".equalsIgnoreCase(area.getNodeName()))
            {
              attrs = area.getAttributes();
              instanceId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
              name = attrs.getNamedItem("name").getNodeValue();
              if(!_names.contains(name))
              {
                _names.add(name);
              }
              resetReuse = new Crontab(attrs.getNamedItem("resetReuse").getNodeValue());
              Node nodeTimelimit = attrs.getNamedItem("timelimit");
              if(nodeTimelimit != null)
              {
                timelimit = Integer.parseInt(nodeTimelimit.getNodeValue());
              }
              Node nodeDispellBuffs = attrs.getNamedItem("dispellBuffs");
              dispellBuffs = nodeDispellBuffs != null ? Boolean.parseBoolean(nodeDispellBuffs.getNodeValue()) : true;
              int minLevel = 0, maxLevel = 0, minParty = 1, maxParty = 9;
              Location tele = new Location();
              Location ret = new Location();
              for(Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
              {
                if("level".equalsIgnoreCase(room.getNodeName()))
                {
                  attrs = room.getAttributes();
                  minLevel = Integer.parseInt(attrs.getNamedItem("min").getNodeValue());
                  maxLevel = Integer.parseInt(attrs.getNamedItem("max").getNodeValue());
                }
              }
              for(Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
              {
                if("party".equalsIgnoreCase(room.getNodeName()))
                {
                  attrs = room.getAttributes();
                  minParty = Integer.parseInt(attrs.getNamedItem("min").getNodeValue());
                  maxParty = Integer.parseInt(attrs.getNamedItem("max").getNodeValue());
                }
              }
              for(Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
              {
                if("return".equalsIgnoreCase(room.getNodeName()))
                {
                  ret = new Location(room.getAttributes().getNamedItem("loc").getNodeValue());
                }
              }
              for(Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
              {
                if("location".equalsIgnoreCase(room.getNodeName()))
                {
                  attrs = room.getAttributes();
                  roomId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
                  for(Node coord = room.getFirstChild(); coord != null; coord = coord.getNextSibling())
                  {
                    if("teleport".equalsIgnoreCase(coord.getNodeName()))
                    {
                      tele = new Location(coord.getAttributes().getNamedItem("loc").getNodeValue());
                    }
                  }
                  if(!_instancedZones.containsKey(instanceId))
                  {
                    _instancedZones.put(instanceId, new FastMap<Integer, InstancedZone>().setShared(true));
                  }
                  instancedZone = new InstancedZone(name, resetReuse, timelimit, minLevel, maxLevel, minParty, maxParty, tele, ret);
                  instancedZone.setDispellBuffs(dispellBuffs);
                  _instancedZones.get(instanceId).put(roomId, instancedZone);
                  for(Node spawn = room.getFirstChild(); spawn != null; spawn = spawn.getNextSibling())
                  {
                    if("spawn".equalsIgnoreCase(spawn.getNodeName()))
                    {
                      attrs = spawn.getAttributes();
                      String[] mobs = attrs.getNamedItem("mobId").getNodeValue().split(" ");
                      Node respawnNode = attrs.getNamedItem("respawn");
                      respawn = respawnNode != null ? Integer.parseInt(respawnNode.getNodeValue()) : 0;
                      Node respawnRndNode = attrs.getNamedItem("respawnRnd");
                      respawnRnd = respawnRndNode != null ? Integer.parseInt(respawnRndNode.getNodeValue()) : 0;
                      Node countNode = attrs.getNamedItem("count");
                      count = countNode != null ? Integer.parseInt(countNode.getNodeValue()) : 1;
                      Node spawnTypeNode = attrs.getNamedItem("type");
                      if(spawnTypeNode == null || spawnTypeNode.getNodeValue().equalsIgnoreCase("point"))
                      {
                        spawnType = 0;
                      }
                      else if(spawnTypeNode.getNodeValue().equalsIgnoreCase("rnd"))
                      {
                        spawnType = 1;
                      }
                      else if(spawnTypeNode.getNodeValue().equalsIgnoreCase("loc"))
                      {
                        spawnType = 2;
                      }
                      else
                      {
                        spawnType = 0;
                        _log.warning("Spawn type  '" + spawnTypeNode.getNodeValue() + "' is unknown!");
                      }
                      int locId = IdFactory.getInstance().getNextId();
                      L2Territory territory = new L2Territory(locId);
                      for(Node location = spawn.getFirstChild(); location != null; location = location.getNextSibling())
                      {
                        if("coords".equalsIgnoreCase(location.getNodeName()))
                        {
                          territory.add(new Location(location.getAttributes().getNamedItem("loc").getNodeValue()));
                        }
                      }
                      if(spawnType == 2) //точечный спавн не проверять
                      {
                        territory.validate();
                      }
                      TerritoryTable.getInstance().getLocations().put(locId, territory);
                      L2World.addTerritory(territory);
                      for(String mob : mobs)
                      {
                        mobId = Integer.parseInt(mob);
                        template = NpcTable.getTemplate(mobId);
                        if(template == null)
                        {
                          _log.warning("Template " + mobId + " not found!");
                        }
                        if(template != null && _instancedZones.containsKey(instanceId) && _instancedZones.get(instanceId).containsKey(roomId))
                        {
                          spawnDat = new L2Spawn(template);
                          spawnDat.setLocation(locId);
                          spawnDat.setRespawnDelay(respawn, respawnRnd);
                          spawnDat.setAmount(count);
                          if(respawn > 0)
                          {
                            spawnDat.startRespawn();
                          }
                          _instancedZones.get(instanceId).get(roomId).getSpawnsInfo().add(new SpawnInfo(locId, spawnDat, spawnType));
                          countGood++;
                          try
                          {
View Full Code Here

      else
      {
        statement.setInt(2, 0);
      }
      rset = statement.executeQuery();
      L2Spawn spawn1;
      L2NpcTemplate template;
      while(rset.next())
      {
        template = NpcTable.getTemplate(rset.getInt("npcId"));
        if(template == null)
        {
          _log.warning("Error loading siege guard, missing npc data in npc table for id: " + rset.getInt("npcId"));
          continue;
        }
        spawn1 = new L2Spawn(template);
        spawn1.setAmount(1);
        spawn1.setLoc(new Location(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"), rset.getInt("heading")));
        spawn1.setRespawnDelay(rset.getInt("isHired") == 1 ? 0 : rset.getInt("respawnDelay"));
        spawn1.setLocation(0);
        _siegeGuardSpawn.add(spawn1);
      }
    }
    catch(Exception e1)
    {
View Full Code Here

    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT * FROM spawnlist ORDER by npc_templateid");
      //TODO возможно в будущем понадобится условие: WHERE npc_templateid NOT IN (SELECT bossId FROM epic_boss_spawn)
      rset = statement.executeQuery();
      L2Spawn spawnDat;
      L2NpcTemplate template1;
      while(rset.next())
      {
        template1 = NpcTable.getTemplate(rset.getInt("npc_templateid"));
        if(template1 != null)
        {
          if(template1.isInstanceOf(L2SiegeGuardInstance.class))
          {
            // Don't spawn Siege Guard
          }
          else if(Config.ALLOW_CLASS_MASTERS_LIST.isEmpty() && template1.name.equalsIgnoreCase("L2ClassMaster"))
          {
            // Dont' spawn class masters
          }
          else
          {
            spawnDat = new L2Spawn(template1);
            spawnDat.setAmount(rset.getInt("count") * (Config.ALT_DOUBLE_SPAWN && !template1.isRaid ? 2 : 1));
            spawnDat.setLocx(rset.getInt("locx"));
            spawnDat.setLocy(rset.getInt("locy"));
            spawnDat.setLocz(rset.getInt("locz"));
            spawnDat.setHeading(rset.getInt("heading"));
            spawnDat.setRespawnDelay(rset.getInt("respawn_delay"), rset.getInt("respawn_delay_rnd"));
            spawnDat.setLocation(rset.getInt("loc_id"));
            spawnDat.setReflection(rset.getLong("reflection"));
            spawnDat.setRespawnTime(0);
            if(template1.isInstanceOf(L2MonsterInstance.class))
            {
              if(template1.name.contains("Lilim") || template1.name.contains("Lith"))
              {
                CatacombSpawnManager.getInstance().addDawnMob(spawnDat);
              }
              else if(template1.name.contains("Nephilim") || template1.name.contains("Gigant"))
              {
                CatacombSpawnManager.getInstance().addDuskMob(spawnDat);
              }
              if(CatacombSpawnManager._monsters.contains(template1.getNpcId()))
              {
                spawnDat.setRespawnDelay(Math.round(rset.getInt("respawn_delay") * Config.ALT_CATACOMB_RESPAWN), Math.round(rset.getInt("respawn_delay_rnd") * Config.ALT_CATACOMB_RESPAWN));
              }
            }
            if(template1.isRaid)
            {
              RaidBossSpawnManager.getInstance().addNewSpawn(spawnDat);
            }
            switch(rset.getInt("periodOfDay"))
            {
              case 0: // default
                spawnDat.init();
                _spawntable.add(spawnDat);
                break;
              case 1: // Day
                DayNightSpawnManager.getInstance().addDayMob(spawnDat);
                break;
View Full Code Here

      Thread.dumpStack();
      return null;
    }
    try
    {
      L2Spawn sp = new L2Spawn(template);
      sp.setLoc(loc);
      sp.setAmount(1);
      sp.setRespawnDelay(0);
      _spawns.add(sp);
      return sp.spawnOne();
    }
    catch(Exception e)
    {
      e.printStackTrace();
      return null;
View Full Code Here

    _territory = new L2RoundTerritoryWithSkill(_effected.getObjectId(), loc.x, loc.y, _skill.getSkillRadius(), loc.z - 200, loc.z + 200, _effector, skill);
    L2World.addTerritory(_territory);
    L2NpcTemplate template = NpcTable.getTemplate(_skill.getSymbolId());
    try
    {
      L2Spawn spawn = new L2Spawn(template);
      spawn.setLoc(loc);
      spawn.setReflection(_effected.getReflection().getId());
      spawn.setAmount(1);
      spawn.init();
      spawn.stopRespawn();
      _symbol = spawn.getLastSpawn();
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
View Full Code Here

      Document doc = factory.newDocumentBuilder().parse(file);
      NamedNodeMap attrs;
      int type;
      int roomId;
      int mobId, delay, count;
      L2Spawn spawnDat;
      L2NpcTemplate template;
      Location tele = new Location();
      int xMin = 0, xMax = 0, yMin = 0, yMax = 0, zMin = 0, zMax = 0;
      boolean isBossRoom;
      for(Node rift = doc.getFirstChild(); rift != null; rift = rift.getNextSibling())
      {
        if("rift".equalsIgnoreCase(rift.getNodeName()))
        {
          for(Node area = rift.getFirstChild(); area != null; area = area.getNextSibling())
          {
            if("area".equalsIgnoreCase(area.getNodeName()))
            {
              attrs = area.getAttributes();
              type = Integer.parseInt(attrs.getNamedItem("type").getNodeValue());
              for(Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
              {
                if("room".equalsIgnoreCase(room.getNodeName()))
                {
                  attrs = room.getAttributes();
                  roomId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
                  Node boss = attrs.getNamedItem("isBossRoom");
                  isBossRoom = boss != null ? Boolean.parseBoolean(boss.getNodeValue()) : false;
                  for(Node coord = room.getFirstChild(); coord != null; coord = coord.getNextSibling())
                  {
                    if("teleport".equalsIgnoreCase(coord.getNodeName()))
                    {
                      attrs = coord.getAttributes();
                      tele = new Location(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());
                    }
                  }
                  int loc_id = IdFactory.getInstance().getNextId();
                  L2Territory territory = new L2Territory(loc_id);
                  territory.add(xMin, yMin, zMin, zMax);
                  territory.add(xMax, yMin, zMin, zMax);
                  territory.add(xMax, yMax, zMin, zMax);
                  territory.add(xMin, yMax, zMin, zMax);
                  territory.validate();
                  TerritoryTable.getInstance().getLocations().put(loc_id, territory);
                  L2World.addTerritory(territory);
                  if(!_rooms.containsKey(type))
                  {
                    _rooms.put(type, new FastMap<Integer, DimensionalRiftRoom>().setShared(true));
                  }
                  _rooms.get(type).put(roomId, new DimensionalRiftRoom(territory, tele, isBossRoom));
                  for(Node spawn = room.getFirstChild(); spawn != null; spawn = spawn.getNextSibling())
                  {
                    if("spawn".equalsIgnoreCase(spawn.getNodeName()))
                    {
                      attrs = spawn.getAttributes();
                      mobId = Integer.parseInt(attrs.getNamedItem("mobId").getNodeValue());
                      delay = Integer.parseInt(attrs.getNamedItem("delay").getNodeValue());
                      count = Integer.parseInt(attrs.getNamedItem("count").getNodeValue());
                      template = NpcTable.getTemplate(mobId);
                      if(template == null)
                      {
                        _log.warning("Template " + mobId + " not found!");
                      }
                      if(!_rooms.containsKey(type))
                      {
                        _log.warning("Type " + type + " not found!");
                      }
                      else if(!_rooms.get(type).containsKey(roomId))
                      {
                        _log.warning("Room " + roomId + " in Type " + type + " not found!");
                      }
                      if(template != null && _rooms.containsKey(type) && _rooms.get(type).containsKey(roomId))
                      {
                        spawnDat = new L2Spawn(template);
                        spawnDat.setLocation(loc_id);
                        spawnDat.setHeading(-1);
                        spawnDat.setRespawnDelay(delay);
                        spawnDat.setAmount(count);
                        _rooms.get(type).get(roomId).getSpawns().add(spawnDat);
                        countGood++;
                      }
                      else
                      {
View Full Code Here

      SquashInstance actor = getActor();
      if(actor == null)
      {
        return;
      }
      L2Spawn spawn = null;
      try
      {
        spawn = new L2Spawn(NpcTable.getTemplate(_npcId));
        spawn.setLoc(actor.getLoc());
        L2NpcInstance npc = spawn.doSpawn(true);
        npc.setAI(new SquashAI(npc));
        ((SquashInstance) npc).setSpawner(actor.getSpawner());
      }
      catch(Exception e)
      {
View Full Code Here

    L2NpcTemplate template = NpcTable.getTemplate(32130);
    for(int[] element : EVENT_MANAGERS)
    {
      try
      {
        L2Spawn sp = new L2Spawn(template);
        sp.setLocx(element[0]);
        sp.setLocy(element[1]);
        sp.setLocz(element[2]);
        sp.setHeading(element[3]);
        sp.setRespawnDelay(0);
        sp.setAmount(1);
        sp.doSpawn(true);
        sp.getLastSpawn().setAI(new Tournament_ai(sp.getLastSpawn()));
        _spawns.add(sp);
      }
      catch(ClassNotFoundException e)
      {
        e.printStackTrace();
View Full Code Here

      Thread.dumpStack();
      return;
    }
    try
    {
      L2Spawn sp = new L2Spawn(template);
      sp.setLoc(spawnPoint);
      sp.setAmount(1);
      sp.setRespawnDelay(0);
      _snowman = sp.doSpawn(true);
    }
    catch(ClassNotFoundException e)
    {
      e.printStackTrace();
    }
    if(_snowman == null)
    {
      return;
    }
    // Спауним Томаса
    template = NpcTable.getTemplate(THOMAS_ID);
    if(template == null)
    {
      System.out.println("WARNING! events.SavingSnowman.captureSnowman template is null for npc: " + THOMAS_ID);
      Thread.dumpStack();
      return;
    }
    Location pos = GeoEngine.findPointToStay(_snowman.getX(), _snowman.getY(), _snowman.getZ(), 100, 120, _snowman.getReflection().getGeoIndex());
    try
    {
      L2Spawn sp = new L2Spawn(template);
      sp.setLoc(pos);
      sp.setAmount(1);
      sp.setRespawnDelay(0);
      _thomas = sp.doSpawn(true);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.L2Spawn

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.