Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2Spawn


            L2NpcTemplate witchTemplate = NpcTable.getInstance().getTemplate(_witchSpawn._npcId);

            // Spawn the festival witch for this arena
            try
            {
                L2Spawn npcSpawn = new L2Spawn(witchTemplate);

                npcSpawn.setLocx(_witchSpawn._x);
                npcSpawn.setLocy(_witchSpawn._y);
                npcSpawn.setLocz(_witchSpawn._z);
                npcSpawn.setHeading(_witchSpawn._heading);
                npcSpawn.setAmount(1);
                npcSpawn.setRespawnDelay(1);

                // Needed as doSpawn() is required to be called also for the NpcInstance it returns.
                npcSpawn.startRespawn();

                SpawnTable.getInstance().addNewSpawn(npcSpawn, false);
                _witchInst = npcSpawn.doSpawn();

                if (Config.DEBUG)
                    _log.fine("SevenSignsFestival: Spawned the Festival Witch " + npcSpawn.getNpcid() + " at " + _witchSpawn._x + " " + _witchSpawn._y + " " + _witchSpawn._z);
            }
            catch (Exception e)
            {
                _log.warning("SevenSignsFestival: Error while spawning Festival Witch ID " + _witchSpawn._npcId + ": " + e);
            }
View Full Code Here


                L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(currSpawn._npcId);

                try
                {
                    L2Spawn npcSpawn = new L2Spawn(npcTemplate);

                    npcSpawn.setLocx(currSpawn._x);
                    npcSpawn.setLocy(currSpawn._y);
                    npcSpawn.setLocz(currSpawn._z);
                    npcSpawn.setHeading(Rnd.nextInt(65536));
                    npcSpawn.setAmount(1);
                    npcSpawn.setRespawnDelay(respawnDelay);

                    // Needed as doSpawn() is required to be called also for the NpcInstance it returns.
                    npcSpawn.startRespawn();

                    SpawnTable.getInstance().addNewSpawn(npcSpawn, false);
                    L2FestivalMonsterInstance festivalMob = (L2FestivalMonsterInstance)npcSpawn.doSpawn();

                    // 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

        {
            con = L2DatabaseFactory.getInstance().getConnection();
            PreparedStatement 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 (!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
                                _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();
                    }
                }
                else
                {
                    _log.warning("SpawnTable: Data missing in NPC table for ID: "
View Full Code Here

            con = L2DatabaseFactory.getInstance().getConnection();

            PreparedStatement statement = con.prepareStatement("SELECT * from raidboss_spawnlist ORDER BY boss_id");
            ResultSet rset = statement.executeQuery();

            L2Spawn spawnDat;
            L2NpcTemplate template;
            long respawnTime;
            while (rset.next())
            {
                template = getValidTemplate(rset.getInt("boss_id"));
                if (template != null)
                {
                    spawnDat = new L2Spawn(template);
                    spawnDat.setLocx(rset.getInt("loc_x"));
                    spawnDat.setLocy(rset.getInt("loc_y"));
                    spawnDat.setLocz(rset.getInt("loc_z"));
                    spawnDat.setAmount(rset.getInt("amount"));
                    spawnDat.setHeading(rset.getInt("heading"));
                    spawnDat.setRespawnMinDelay(rset.getInt("respawn_min_delay"));
                    spawnDat.setRespawnMaxDelay(rset.getInt("respawn_max_delay"));
                    respawnTime = rset.getLong("respawn_time");

                    addNewSpawn(spawnDat, respawnTime, rset.getDouble("currentHP"), rset.getDouble("currentMP"), false);
                }
                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();
                if(!isInsideRadius(bossSpawn.getLocx(),bossSpawn.getLocy(),bossSpawn.getLocz(), 5000, true, false))
                {
                    teleToLocation(bossSpawn.getLocx(),bossSpawn.getLocy(),bossSpawn.getLocz(), true);
                    healFull(); // prevents minor exploiting with it
                }
                _minionList.maintainMinions();
            }
        }, 60000, getMaintenanceInterval()+Rnd.get(5000));
View Full Code Here

  public void notifyPlayerDead()
  {
    // Monster kill player and can by deleted
    deleteMe();

    L2Spawn spawn = getSpawn();
    if (spawn != null)
    {
      spawn.stopRespawn();
      SpawnTable.getInstance().deleteSpawn(spawn, false);
    }
  }
View Full Code Here

                    offset = Rnd.get(2); // Get the direction of the offset
                    if (offset == 0) {offset = -1;} // make offset negative
                    offset *= Rnd.get(50, 100);
                    y += offset;
                }      
                L2Spawn spawn = new L2Spawn(template);
                spawn.setHeading(heading);
                spawn.setLocx(x);
                spawn.setLocy(y);
                spawn.setLocz(z+20);
                spawn.stopRespawn();
                result = spawn.spawnOne();

              if (despawnDelay > 0)
                ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(result), despawnDelay);
             
              return result;
View Full Code Here

      template1 = NpcTable.getInstance().getTemplateByName(monsterId);
    }

    try
    {
      L2Spawn spawn = new L2Spawn(template1);
      spawn.setLocx(target.getX());
      spawn.setLocy(target.getY());
      spawn.setLocz(target.getZ());
      spawn.setAmount(mobCount);
      spawn.setHeading(activeChar.getHeading());
      spawn.setRespawnDelay(respawnTime);
      if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcid()))
        activeChar.sendMessage("You cannot spawn another instance of " + template1.name + ".");
      else
      {
        if (RaidBossSpawnManager.getInstance().getValidTemplate(spawn.getNpcid()) != null)
          RaidBossSpawnManager.getInstance().addNewSpawn(spawn, 0, template1.getStatsSet().getDouble("baseHpMax"), template1.getStatsSet().getDouble("baseMpMax"), permanent);
        else
          SpawnTable.getInstance().addNewSpawn(spawn, permanent);
        spawn.init();
        if (!permanent)
          spawn.stopRespawn();
        activeChar.sendMessage("Created " + template1.name + " on " + target.getObjectId());
      }
    }
    catch (Exception e)
    {
View Full Code Here

        if ((obj != null) && (obj instanceof L2NpcInstance))
        {
            L2NpcInstance target = (L2NpcInstance) obj;
            target.deleteMe();

            L2Spawn spawn = target.getSpawn();
            if (spawn != null)
            {
                spawn.stopRespawn();

                if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcid())) RaidBossSpawnManager.getInstance().deleteSpawn(
                                                                                                                                   spawn,
                                                                                                                                   true);
                else SpawnTable.getInstance().deleteSpawn(spawn, true);
            }
View Full Code Here

TOP

Related Classes of net.sf.l2j.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.