Package net.sf.l2j.gameserver.model

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


                activeChar.sendMessage("Incorrect monster template.");
                _log.warning("ERROR: NPC " + target.getObjectId() + " has a 'null' template.");
                return;
            }

            L2Spawn spawn = target.getSpawn();
            if (spawn == null)
            {
                activeChar.sendMessage("Incorrect monster spawn.");
                _log.warning("ERROR: NPC " + target.getObjectId() + " has a 'null' spawn.");
                return;
            }
            int respawnTime = spawn.getRespawnDelay();

            target.deleteMe();
            spawn.stopRespawn();
            SpawnTable.getInstance().deleteSpawn(spawn, true);

            try
            {
                //L2MonsterInstance mob = new L2MonsterInstance(monsterTemplate, template1);

                spawn = new L2Spawn(template1);
                spawn.setLocx(activeChar.getX());
                spawn.setLocy(activeChar.getY());
                spawn.setLocz(activeChar.getZ());
                spawn.setAmount(1);
                spawn.setHeading(activeChar.getHeading());
                spawn.setRespawnDelay(respawnTime);
                SpawnTable.getInstance().addNewSpawn(spawn, true);
                spawn.init();

                SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
                sm.addString("Created " + template1.name + " on " + target.getObjectId() + ".");
                activeChar.sendPacket(sm);

                if (Config.DEBUG)
                {
                    _log.fine("Spawn at X="+spawn.getLocx()+" Y="+spawn.getLocy()+" Z="+spawn.getLocz());
                    _log.warning("GM: "+activeChar.getName()+"("+activeChar.getObjectId()+") moved NPC " + target.getObjectId());
                }
            }
            catch (Exception e)
            {
View Full Code Here


            }
            else if (command.startsWith("npcfind_byid"))
            {
                try
                {
                    L2Spawn spawn = SpawnTable.getInstance().getTemplate(Integer.parseInt(command.substring(12).trim()));
                   
                    if(spawn!=null)
                        player.sendPacket(new RadarControl(0,1,spawn.getLocx(),spawn.getLocy(),spawn.getLocz()));
                } catch (NumberFormatException nfe)
                {
                    player.sendMessage("Wrong command parameters");
                }
            }
View Full Code Here

        try
        {
            //L2MonsterInstance mob = new L2MonsterInstance(template1);

            L2Spawn spawn = new L2Spawn(template1);

            spawn.setLocx(target.getX() + 50);
            spawn.setLocy(target.getY() + 50);
            spawn.setLocz(target.getZ());
            spawn.setAmount(1);
            spawn.setHeading(target.getHeading());
            spawn.setRespawnDelay(1);

            SpawnTable.getInstance().addNewSpawn(spawn, false);

            spawn.init();
            spawn.getLastSpawn().setCurrentHp(999999999);
            spawn.getLastSpawn().setName("event inscriptor");
            spawn.getLastSpawn().setTitle(L2Event.eventName);
            spawn.getLastSpawn().isEventMob = true;
            spawn.getLastSpawn().isAggressive();
            spawn.getLastSpawn().decayMe();
            spawn.getLastSpawn().spawnMe(spawn.getLastSpawn().getX(), spawn.getLastSpawn().getY(),
                                         spawn.getLastSpawn().getZ());

            spawn.getLastSpawn().broadcastPacket(
                                                 new MagicSkillUser(spawn.getLastSpawn(),
                                                                    spawn.getLastSpawn(), 1034, 1, 1, 1));

            npcs.add(String.valueOf(spawn.getLastSpawn().getObjectId()));

        }
        catch (Exception e)
        {
            System.out.println(e);
View Full Code Here

      return false;
    }

        try
        {
            _npcSpawn = new L2Spawn(tmpl);

            _npcSpawn.setLocx(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0]);
            _npcSpawn.setLocy(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1]);
            _npcSpawn.setLocz(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[2]);
            _npcSpawn.setAmount(1);
View Full Code Here

       while(L2Event.npcs.size()>0){
           try{
               npc = (L2NpcInstance) L2World.getInstance().findObject(Integer.parseInt(L2Event.npcs.getFirst()));


           L2Spawn spawn = npc.getSpawn();

           if (spawn != null)
           {
               spawn.stopRespawn();
               SpawnTable.getInstance().deleteSpawn(spawn, true);
           }
           npc.deleteMe();
           L2Event.npcs.removeFirst();}catch(Exception e) {L2Event.npcs.removeFirst();}
       }
View Full Code Here

                int bossId = Integer.parseInt(command.substring(12).trim());
                switch (RaidBossSpawnManager.getInstance().getRaidBossStatusId(bossId))
                {
                    case ALIVE:
                    case DEAD:
                        L2Spawn spawn = RaidBossSpawnManager.getInstance().getSpawns().get(bossId);
                        player.sendPacket(new RadarControl(0, 1, spawn.getLocx(), spawn.getLocy(),
                                                           spawn.getLocz()));
                        break;
                    case UNDEFINED:
                        player.sendMessage("This Boss isn't in game - notify L2J Datapack Dev Team");
                        break;
                }
View Full Code Here

            Document doc = factory.newDocumentBuilder().parse(file);
            NamedNodeMap attrs;
            byte type, roomId;
            int mobId, x, y, z, delay, count;
            L2Spawn spawnDat;
            L2NpcTemplate template;

            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 = Byte.parseByte(attrs.getNamedItem("type").getNodeValue());

                            for (Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
                            {
                                if ("room".equalsIgnoreCase(room.getNodeName()))
                                {
                                    attrs = room.getAttributes();
                                    roomId = Byte.parseByte(attrs.getNamedItem("id").getNodeValue());

                                    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.getInstance().getTemplate(mobId);
                                            if(template==null)_log.warn("Template "+mobId+" not found!");
                                            if(!_rooms.containsKey(type))_log.warn("Type "+type+" not found!");
                                            else if(!_rooms.get(type).containsKey(roomId))_log.warn("Room "+roomId+" in Type "+type+" not found!");

                                            for (int i = 0; i < count; i++)
                                            {
                                              DimensionalRiftRoom riftRoom = _rooms.get(type).get(roomId);
                                              x = riftRoom.getRandomX();
                                              y = riftRoom.getRandomY();
                                              z = riftRoom.getTeleportCoords()[2];

                                              if (template != null && _rooms.containsKey(type) && _rooms.get(type).containsKey(roomId))
                                              {
                                                  spawnDat = new L2Spawn(template);
                                                  spawnDat.setAmount(1);
                                                  spawnDat.setLocx(x);
                                                  spawnDat.setLocy(y);
                                                  spawnDat.setLocz(z);
                                                  spawnDat.setHeading(-1);
                                                  spawnDat.setRespawnDelay(delay);
                                                  SpawnTable.getInstance().addNewSpawn(spawnDat, false);
                                                  _rooms.get(type).get(roomId).getSpawns().add(spawnDat);
                                                  countGood++;
                                              }
                                              else
View Full Code Here

        if (target == null)
            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());
            L2World.getInstance().storeObject(spawn.spawnOne());

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

            SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
            sm.addString("Created " + template1.name + " at x: " + spawn.getLocx() + " y: " + spawn.getLocy() + " z: " + spawn.getLocz());
            activeChar.sendPacket(sm);
        }
        catch (Exception e)
        {
            SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
View Full Code Here

                statement.setInt(2, 1);
            else
                statement.setInt(2, 0);
            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);
                }
                else
                {
View Full Code Here

        switch (sitem.getType())
        {
        case 0: // static summons (like christmas tree)
            try
            {
                L2Spawn spawn = new L2Spawn(npcTemplate);
               
                spawn.setId(IdFactory.getInstance().getNextId());
                spawn.setLocx(activeChar.getX());
                spawn.setLocy(activeChar.getY());
                spawn.setLocz(activeChar.getZ());
                L2World.getInstance().storeObject(spawn.spawnOne());
                activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
                activeChar.sendMessage("Created " + npcTemplate.name + " at x: " + spawn.getLocx() + " y: " + spawn.getLocy() + " z: " + spawn.getLocz());
            }
            catch (Exception e)
            {
                activeChar.sendMessage("Target is not ingame.");
            }
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.