Package com.l2jfrozen.gameserver.model.spawn

Examples of com.l2jfrozen.gameserver.model.spawn.L2Spawn$SpawnTask


   
    @Override
    public void run()
    {
      int npcId;
      L2Spawn antharasSpawn = null;
     
      switch (_taskId)
      {
        case 1: // Spawn.
          // Strength of Antharas is decided by the number of players that
          // invaded the lair.
          _monsterSpawnTask.cancel(false);
          _monsterSpawnTask = null;
          if (FWA_OLDANTHARAS)
            npcId = 29019; // old
          else if (_players == null || _players!=null && _players.size() <= FWA_LIMITOFWEAK)
            npcId = 29066; // weak
          else if (_players!=null && _players.size() > FWA_LIMITOFNORMAL)
            npcId = 29068; // strong
          else
            npcId = 29067; // normal
         
          // Do spawn.
          antharasSpawn = _monsterSpawn.get(npcId);
          _antharas = (L2GrandBossInstance) antharasSpawn.doSpawn();
          GrandBossManager.getInstance().addBoss(_antharas);
         
          _monsters.add(_antharas);
          _antharas.setIsImobilised(true);
         
View Full Code Here


    {
      @Override
      public void run()
      {
        // Teleport raid boss home if it's too far from home location
        L2Spawn bossSpawn = getSpawn();
       
        int rb_lock_range = Config.RBLOCKRAGE;
        if(Config.RBS_SPECIFIC_LOCK_RAGE.get(bossSpawn.getNpcid())!=null){
          rb_lock_range = Config.RBS_SPECIFIC_LOCK_RAGE.get(bossSpawn.getNpcid());
        }
       
        if(rb_lock_range>=100 && !isInsideRadius(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), rb_lock_range, true, false))
        {
          teleToLocation(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), true);
          //healFull(); // Prevents minor exploiting with it
        }
       
        _minionList.maintainMinions();
      }
View Full Code Here

   
    @Override
    public void run()
    {
      L2NpcTemplate template1;
      L2Spawn tempSpawn;
      boolean isBehemoth = Rnd.get(100) < FWA_PERCENTOFBEHEMOTH;
      try
      {
        int mobNumber = (isBehemoth ? 2 : 3);
        // Set spawn.
        for(int i = 0; i < mobNumber; i++)
        {
          if (_monsters.size() >= FWA_MAXMOBS)
            break;
          int npcId;
          if (isBehemoth)
            npcId = 29069;
          else
            npcId = Rnd.get(29070, 29076);
          template1 = NpcTable.getInstance().getTemplate(npcId);
          tempSpawn = new L2Spawn(template1);
          // allocates it at random in the lair of Antharas.
          int tried = 0;
          boolean notFound = true;
          int x = 175000;
          int y = 112400;
          int dt = (_antharas.getX() - x) * (_antharas.getX() - x) + (_antharas.getY() - y) * (_antharas.getY() - y);
          while (tried++ < 25 && notFound)
          {
            int rx = Rnd.get(175000, 179900);
            int ry = Rnd.get(112400, 116000);
            int rdt = (_antharas.getX() - rx) * (_antharas.getX() - rx) + (_antharas.getY() - ry) * (_antharas.getY() - ry);
            if (GeoData.getInstance().canSeeTarget(_antharas.getX(), _antharas.getY(), -7704, rx, ry, -7704))
              if (rdt < dt)
              {
                x = rx;
                y = ry;
                dt = rdt;
                if (rdt <= 900000)
                  notFound = false;
              }
          }
          tempSpawn.setLocx(x);
          tempSpawn.setLocy(y);
          tempSpawn.setLocz(-7704);
          tempSpawn.setHeading(0);
          tempSpawn.setAmount(1);
          tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
          SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
          // Do spawn.
          _monsters.add(tempSpawn.doSpawn());
        }
      }
      catch (Exception e)
      {
        _log.warning(e.getMessage());
View Full Code Here

      target = activeChar;
    }

    try
    {
      L2Spawn spawn = new L2Spawn(template1);
      spawn.setId(IdFactory.getInstance().getNextId());
      spawn.setLocx(target.getX());
      spawn.setLocy(target.getY());
      spawn.setLocz(target.getZ());
      L2NpcInstance result = spawn.spawnOne();

      activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);

      SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
      activeChar.sendPacket(sm);
View Full Code Here

      con = L2DatabaseFactory.getInstance().getConnection(false);
      PreparedStatement statement = con.prepareStatement("SELECT * FROM fort_siege_guards Where fortId = ? ");
      statement.setInt(1, getFort().getFortId());
      ResultSet rs = statement.executeQuery();

      L2Spawn spawn1;
      L2NpcTemplate template1;

      while(rs.next())
      {
        template1 = NpcTable.getInstance().getTemplate(rs.getInt("npcId"));
        if(template1 != null)
        {
          spawn1 = new L2Spawn(template1);
          spawn1.setId(rs.getInt("id"));
          spawn1.setAmount(1);
          spawn1.setLocx(rs.getInt("x"));
          spawn1.setLocy(rs.getInt("y"));
          spawn1.setLocz(rs.getInt("z"));
          spawn1.setHeading(rs.getInt("heading"));
          spawn1.setRespawnDelay(rs.getInt("respawnDelay"));
          spawn1.setLocation(0);
          _siegeGuardSpawn.add(spawn1);
          spawn1 = null;
        }
        else
        {
View Full Code Here

      con = L2DatabaseFactory.getInstance().getConnection(false);
      PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
      statement.setInt(1, 22195);
      ResultSet rset = statement.executeQuery();

      L2Spawn spawnDat;
      L2NpcTemplate template1;

      while(rset.next())
      {
        template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
        if(template1 != null)
        {
          spawnDat = new L2Spawn(template1);
          spawnDat.setAmount(rset.getInt("count"));
          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"));
          SpawnTable.getInstance().addNewSpawn(spawnDat, false);
          _ritualSacrificeSpawn = spawnDat;
        }
        else
        {
View Full Code Here

  protected void spawnOneTree(int id, int x, int y, int z)
  {
    try
    {
      L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(id);
      L2Spawn spawn = new L2Spawn(template1);

      template1 = null;

      spawn.setId(IdFactory.getInstance().getNextId());

      spawn.setLocx(x);
      spawn.setLocy(y);
      spawn.setLocz(z);

      L2NpcInstance tree = spawn.spawnOne();
      L2World.getInstance().storeObject(tree);
      objectQueue.add(tree);

      spawn = null;
      tree = null;
View Full Code Here

    {
      @Override
      public void run()
      {
        // Teleport raid boss home if it's too far from home location
        L2Spawn bossSpawn = getSpawn();
       
        int rb_lock_range = Config.RBLOCKRAGE;
        if(Config.RBS_SPECIFIC_LOCK_RAGE.get(bossSpawn.getNpcid())!=null){
          rb_lock_range = Config.RBS_SPECIFIC_LOCK_RAGE.get(bossSpawn.getNpcid());
        }
       
        if(rb_lock_range>=100 && !isInsideRadius(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), rb_lock_range, true, false))
        {
          teleToLocation(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), true);
          //healFull(); // Prevents minor exploiting with it
        }
       
        _minionList.maintainMinions();
      }
View Full Code Here

        statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM spawnlist ORDER BY id");
      }

      ResultSet rset = statement.executeQuery();

      L2Spawn spawnDat;
      L2NpcTemplate template1;

      while(rset.next())
      {
        template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
        if(template1 != null)
        {
          if(template1.type.equalsIgnoreCase("L2SiegeGuard"))
          {
            // Don't spawn
          }
          else if(template1.type.equalsIgnoreCase("L2RaidBoss"))
          {
            // Don't spawn raidboss
          }
          else if (template1.type.equalsIgnoreCase("L2GrandBoss"))
          {
            // Don't spawn grandboss
          }
          else if(!Config.ALLOW_CLASS_MASTERS && template1.type.equals("L2ClassMaster"))
          {
            // Dont' spawn class masters
          }
          else
          {
            spawnDat = new L2Spawn(template1);
            spawnDat.setId(rset.getInt("id"));
            spawnDat.setAmount(rset.getInt("count"));
            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"));

            int loc_id = rset.getInt("loc_id");

            spawnDat.setLocation(loc_id);

            //template1 = null;

            switch(rset.getInt("periodOfDay"))
            {
              case 0: // default
                _npcSpawnCount += spawnDat.init();
                break;
              case 1: // Day
                DayNightSpawnManager.getInstance().addDayCreature(spawnDat);
                _npcSpawnCount++;
                break;
              case 2: // Night
                DayNightSpawnManager.getInstance().addNightCreature(spawnDat);
                _npcSpawnCount++;
                break;
            }

            _spawntable.put(spawnDat.getId(), spawnDat);
            if(spawnDat.getId() > _highestId)
            {
              _highestId = spawnDat.getId();
            }
            if (spawnDat.getTemplate().getNpcId() == Olympiad.OLY_MANAGER)
            {
              Olympiad.olymanagers.add(spawnDat);
            }
            spawnDat = null;
          }
        }
        else
        {
          _log.warning("SpawnTable: Data missing in NPC table for ID: {}. "+ rset.getInt("npc_templateid"));
        }
      }
      statement.close();
      rset.close();
    }
    catch(Exception e)
    {
      _log.severe("SpawnTable: Spawn could not be initialized "+ e);
    }
    finally
    {
      CloseUtil.close(con);
    }

    _log.finest("SpawnTable: Loaded {} Npc Spawn Locations. "+ _spawntable.size());
    _log.finest("SpawnTable: Spawning completed, total number of NPCs in the world: {} "+ _npcSpawnCount);

    //-------------------------------Custom Spawnlist----------------------------//
    if(Config.CUSTOM_SPAWNLIST_TABLE)
    {
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection(false);
       
        final PreparedStatement statement;
       
        if(Config.DELETE_GMSPAWN_ON_CUSTOM)
        {
          statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM custom_spawnlist where id NOT in ( select id from custom_notspawned where isCustom = false ) ORDER BY id");
        }
        else
        {
          statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM custom_spawnlist ORDER BY id");
        }

        //PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM custom_spawnlist ORDER BY id");
        final ResultSet rset = statement.executeQuery();

        L2Spawn spawnDat;
        L2NpcTemplate template1;

        while(rset.next())
        {
          template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));

          if(template1 != null)
          {
            if(template1.type.equalsIgnoreCase("L2SiegeGuard"))
            {
              // Don't spawn
            }
            else if(template1.type.equalsIgnoreCase("L2RaidBoss"))
            {
              // Don't spawn raidboss
            }
            else if(!Config.ALLOW_CLASS_MASTERS && template1.type.equals("L2ClassMaster"))
            {
              // Dont' spawn class masters
            }
            else
            {
              spawnDat = new L2Spawn(template1);
              spawnDat.setId(rset.getInt("id"));
              spawnDat.setAmount(rset.getInt("count"));
              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"));

              int loc_id = rset.getInt("loc_id");

              spawnDat.setLocation(loc_id);

              switch(rset.getInt("periodOfDay"))
              {
                case 0: // default
                  _customSpawnCount += spawnDat.init();
                  break;
                case 1: // Day
                  DayNightSpawnManager.getInstance().addDayCreature(spawnDat);
                  _customSpawnCount++;
                  break;
                case 2: // Night
                  DayNightSpawnManager.getInstance().addNightCreature(spawnDat);
                  _customSpawnCount++;
                  break;
              }

              _spawntable.put(spawnDat.getId(), spawnDat);
              if(spawnDat.getId() > _highestId)
              {
                _highestId = spawnDat.getId();
              }
            }
          }
          else
          {
View Full Code Here

    _minionMaintainTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable() {
      @Override
      public void run()
      {
        // teleport raid boss home if it's too far from home location
        L2Spawn bossSpawn = getSpawn();
       
        int rb_lock_range = Config.RBLOCKRAGE;
        if(Config.RBS_SPECIFIC_LOCK_RAGE.get(bossSpawn.getNpcid())!=null){
          rb_lock_range = Config.RBS_SPECIFIC_LOCK_RAGE.get(bossSpawn.getNpcid());
        }
       
        if(rb_lock_range!=-1 && !isInsideRadius(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), rb_lock_range, true, false))
        {
          teleToLocation(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), true);
          //healFull(); // Prevents minor exploiting with it
        }
        /*
        if(!isInsideRadius(bossSpawn.getLocx(), bossSpawn.getLocy(), bossSpawn.getLocz(), 5000, true, false))
        {
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.spawn.L2Spawn$SpawnTask

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.