Package l2p.gameserver.model

Examples of l2p.gameserver.model.L2Spawn


  {
    _state = new EpicBossState(BAIUM);
    _zone = ZoneManager.getInstance().getZoneById(ZoneType.epic, 702001, false);
    try
    {
      L2Spawn tempSpawn;
      // Statue of Baium
      _statueSpawn = new L2Spawn(NpcTable.getTemplate(BAIUM_NPC));
      _statueSpawn.setAmount(1);
      _statueSpawn.setLoc(STATUE_LOCATION);
      _statueSpawn.stopRespawn();
      // Baium
      tempSpawn = new L2Spawn(NpcTable.getTemplate(BAIUM));
      tempSpawn.setAmount(1);
      _monsterSpawn.put(BAIUM, tempSpawn);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    // Teleport Cube
    try
    {
      L2NpcTemplate Cube = NpcTable.getTemplate(TELEPORT_CUBE);
      L2Spawn _teleportCubeSpawn = new L2Spawn(Cube);
      _teleportCubeSpawn.setAmount(1);
      _teleportCubeSpawn.setLoc(CUBE_LOCATION);
      _teleportCubeSpawn.setRespawnDelay(60);
      _teleportCubeSpawn.setLocation(0);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    // Archangels
    try
    {
      L2NpcTemplate angel = NpcTable.getTemplate(ARCHANGEL);
      L2Spawn spawnDat;
      _angelSpawns.clear();
      // 5 random numbers of 10, no duplicates
      GArray<Integer> random = new GArray<Integer>();
      for(int i = 0; i < 5; i++)
      {
        int r = -1;
        while(r == -1 || random.contains(r))
        {
          r = Rnd.get(10);
        }
        random.add(r);
      }
      for(int i : random)
      {
        spawnDat = new L2Spawn(angel);
        spawnDat.setAmount(1);
        spawnDat.setLoc(ANGEL_LOCATION[i]);
        spawnDat.setRespawnDelay(300000);
        spawnDat.setLocation(0);
        _angelSpawns.add(spawnDat);
      }
    }
    catch(Exception e)
    {
View Full Code Here


  public static void spawnBaium(L2NpcInstance NpcBaium, L2Player awake_by)
  {
    Dying = false;
    _npcBaium = NpcBaium;
    // do spawn.
    L2Spawn baiumSpawn = _monsterSpawn.get(BAIUM);
    baiumSpawn.setLoc(_npcBaium.getLoc());
    // delete statue
    _npcBaium.getSpawn().stopRespawn();
    _npcBaium.deleteMe();
    final L2BossInstance baium = (L2BossInstance) baiumSpawn.doSpawn(true);
    _monsters.add(baium);
    _state.setRespawnDate(getRespawnInterval());
    _state.setState(EpicBossState.State.ALIVE);
    _state.update();
    Log.add("Spawned Baium, awake by: " + awake_by, "bosses");
View Full Code Here

    {
      if(Rnd.chance(92))
      {
        try
        {
          L2Spawn sp = new L2Spawn(NpcTable.getTemplate(Stakato_Cheif));
          Location pos = GeoEngine.findPointToStay(actor.getX(), actor.getY(), actor.getZ(), 0, 0, actor.getReflection().getGeoIndex());
          sp.setLoc(pos);
          L2NpcInstance npc = sp.doSpawn(true);
          actor.broadcastPacket(new SocialAction(actor.getObjectId(), 1));
          npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster, Rnd.get(1, 100));
          actor.doDie(caster);
        }
        catch(Exception e)
View Full Code Here

    for(int i = 0; i < 9; i++)
    {
      try
      {
        pos = GeoEngine.findPointToStay(144298, 154420, -11854, 300, 320, actor.getReflection().getGeoIndex());
        L2Spawn sp = new L2Spawn(NpcTable.getTemplate(Tears_Copy));
        sp.setLoc(pos);
        sp.setReflection(actor.getReflection().getId());
        L2NpcInstance copy = sp.doSpawn(true);
        spawns.add(copy);
        // Атакуем случайную цель
        hated = actor.getRandomHated();
        if(hated != null)
        {
View Full Code Here

        L2Object obj = activeChar.getTarget();
        if(obj != null && obj.isNpc())
        {
          L2NpcInstance target = (L2NpcInstance) obj;
          target.deleteMe();
          L2Spawn spawn = target.getSpawn();
          if(spawn != null)
          {
            spawn.stopRespawn();
          }
        }
        else
        {
          activeChar.sendPacket(Msg.INVALID_TARGET);
View Full Code Here

    int z = GeoEngine.getHeight(x, y, sloc.z, actor.getReflection().getGeoIndex());
    if(sloc.z - z > 64)
    {
      return false;
    }
    L2Spawn spawn = actor.getSpawn();
    if(spawn != null && spawn.getLocation() != 0 && !TerritoryTable.getInstance().getLocation(spawn.getLocation()).isInside(x, y))
    {
      return false;
    }
    actor.broadcastPacketToOthers(new MagicSkillUse(actor, actor, 4671, 1, 500, 0));
    ThreadPoolManager.getInstance().scheduleAi(new Teleport(new Location(x, y, z)), 500, false);
View Full Code Here

    {
      return false;
    }
    StringTokenizer st;
    L2NpcInstance target;
    L2Spawn spawn;
    L2NpcInstance npc;
    switch(command)
    {
      case admin_show_spawns:
        activeChar.sendPacket(new NpcHtmlMessage(5).setFile("data/html/admin/spawns.htm"));
        break;
      case admin_spawn_index:
        try
        {
          String val = fullString.substring(18);
          activeChar.sendPacket(new NpcHtmlMessage(5).setFile("data/html/admin/spawns/" + val + ".htm"));
        }
        catch(StringIndexOutOfBoundsException e)
        {
        }
        break;
      case admin_spawn1:
        st = new StringTokenizer(fullString, " ");
        try
        {
          st.nextToken();
          String id = st.nextToken();
          int mobCount = 1;
          if(st.hasMoreTokens())
          {
            mobCount = Integer.parseInt(st.nextToken());
          }
          spawnMonster(activeChar, id, 0, mobCount);
        }
        catch(Exception e)
        {
          // Case of wrong monster data
        }
        break;
      case admin_spawn:
      case admin_spawn_monster:
        st = new StringTokenizer(fullString, " ");
        try
        {
          st.nextToken();
          String id = st.nextToken();
          int respawnTime = 30;
          int mobCount = 1;
          if(st.hasMoreTokens())
          {
            mobCount = Integer.parseInt(st.nextToken());
          }
          if(st.hasMoreTokens())
          {
            respawnTime = Integer.parseInt(st.nextToken());
          }
          spawnMonster(activeChar, id, respawnTime, mobCount);
          if(Config.SpawnMobToConsole)
          {
            System.out.println("INSERT INTO spawnlist VALUES ('', '1', '" + id + "', '" + activeChar.getX() + "', '" + activeChar.getY() + "', '" + activeChar.getZ() + "', '" + activeChar.getHeading() + "', '" + respawnTime + "', '0', '0', '0', '0');");
          }
        }
        catch(Exception e)
        {
          // Case of wrong monster data
        }
        break;
      case admin_unspawnall:
        for(L2Player player : L2ObjectsStorage.getAllPlayersForIterate())
        {
          player.sendPacket(Msg.THE_NPC_SERVER_IS_NOT_OPERATING);
        }
        L2World.deleteVisibleNpcSpawns();
        GmListTable.broadcastMessageToGMs("NPC Unspawn completed!");
        break;
      case admin_setai:
        if(activeChar.getTarget() == null || !activeChar.getTarget().isNpc())
        {
          activeChar.sendMessage("Please select target NPC or mob.");
          return false;
        }
        st = new StringTokenizer(fullString, " ");
        st.nextToken();
        if(!st.hasMoreTokens())
        {
          activeChar.sendMessage("Please specify AI name.");
          return false;
        }
        String aiName = st.nextToken();
        target = (L2NpcInstance) activeChar.getTarget();
        Constructor<?> aiConstructor = null;
        try
        {
          if(!aiName.equalsIgnoreCase("npc"))
          {
            aiConstructor = Class.forName("l2p.gameserver.ai." + aiName).getConstructors()[0];
          }
        }
        catch(Exception e)
        {
          try
          {
            aiConstructor = ScriptManager.getInstance().getClasses().get("ai." + aiName).getRawClass().getConstructors()[0];
          }
          catch(Exception e1)
          {
            activeChar.sendMessage("This type AI not found.");
            return false;
          }
        }
        if(aiConstructor != null)
        {
          try
          {
            target.setAI((L2CharacterAI) aiConstructor.newInstance(target));
          }
          catch(Exception e)
          {
            e.printStackTrace();
          }
          target.getAI().startAITask();
        }
        break;
      case admin_setaiparam:
        if(activeChar.getTarget() == null || !activeChar.getTarget().isNpc())
        {
          activeChar.sendMessage("Please select target NPC or mob.");
          return false;
        }
        st = new StringTokenizer(fullString, " ");
        st.nextToken();
        if(!st.hasMoreTokens())
        {
          activeChar.sendMessage("Please specify AI parameter name.");
          activeChar.sendMessage("USAGE: //setaiparam <param> <value>");
          return false;
        }
        String paramName = st.nextToken();
        if(!st.hasMoreTokens())
        {
          activeChar.sendMessage("Please specify AI parameter value.");
          activeChar.sendMessage("USAGE: //setaiparam <param> <value>");
          return false;
        }
        String paramValue = st.nextToken();
        target = (L2NpcInstance) activeChar.getTarget();
        ((DefaultAI) target.getAI()).set(paramName, paramValue);
        target.decayMe();
        target.spawnMe();
        activeChar.sendMessage("AI parameter " + paramName + " succesfully setted to " + paramValue);
        break;
      case admin_dumpaiparams:
        if(activeChar.getTarget() == null || !activeChar.getTarget().isNpc())
        {
          activeChar.sendMessage("Please select target NPC or mob.");
          return false;
        }
        target = (L2NpcInstance) activeChar.getTarget();
        StatsSet set = target.getTemplate().getAIParams();
        if(set != null)
        {
          System.out.println("Dump of AI Params:\r\n" + set.dump());
        }
        else
        {
          System.out.println("AI Params not setted.");
        }
        break;
      case admin_setheading:
        L2Object obj = activeChar.getTarget();
        if(!obj.isNpc())
        {
          activeChar.sendMessage("Target is incorrect!");
          return false;
        }
        npc = (L2NpcInstance) obj;
        npc.setHeading(activeChar.getHeading());
        npc.decayMe();
        npc.spawnMe();
        activeChar.sendMessage("New heading : " + activeChar.getHeading());
        spawn = npc.getSpawn();
        if(spawn == null)
        {
          activeChar.sendMessage("Spawn for this npc == null!");
          return false;
        }
        if(!mysql.set("update spawnlist set heading = " + activeChar.getHeading() //
          + " where npc_templateid = " + npc.getNpcId() //
          + " and locx = " + spawn.getLocx() //
          + " and locy = " + spawn.getLocy() //
          + " and locz = " + spawn.getLocz() //
          + " and loc_id = " + spawn.getLocation()))
        {
          activeChar.sendMessage("Error in mysql query!");
          return false;
        }
        break;
View Full Code Here

      activeChar.sendMessage("Incorrect monster template.");
      return;
    }
    try
    {
      L2Spawn spawn = new L2Spawn(template);
      spawn.setLoc(target.getLoc());
      spawn.setLocation(0);
      spawn.setAmount(mobCount);
      spawn.setHeading(activeChar.getHeading());
      spawn.setRespawnDelay(respawnTime);
      spawn.setReflection(activeChar.getReflection().getId());
      if(RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcId()))
      {
        activeChar.sendMessage("Raid Boss " + template.name + " already spawned.");
      }
      else
      {
        spawn.init();
        if(respawnTime == 0)
        {
          spawn.stopRespawn();
        }
        activeChar.sendMessage("Created " + template.name + " on " + target.getObjectId() + ".");
      }
    }
    catch(Exception e)
View Full Code Here

      for(int i = 0; i < MOBS_COUNT; i++)
      {
        try
        {
          Location pos = GeoEngine.findPointToStay(actor.getX(), actor.getY(), actor.getZ(), 100, 120, actor.getReflection().getGeoIndex());
          L2Spawn sp = new L2Spawn(NpcTable.getTemplate(MOBS));
          sp.setLoc(pos);
          L2NpcInstance npc = sp.doSpawn(true);
          if(caster.isPet() || caster.isSummon())
          {
            npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster, Rnd.get(2, 100));
          }
          npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, caster.getPlayer(), Rnd.get(1, 100));
View Full Code Here

  {
    L2Object obj = activeChar.getTarget();
    if(obj != null && obj.isNpc())
    {
      L2NpcInstance target = (L2NpcInstance) obj;
      L2Spawn spawn = target.getSpawn();
      int monsterTemplate = target.getTemplate().npcId;
      L2NpcTemplate template1 = NpcTable.getTemplate(monsterTemplate);
      if(template1 == null)
      {
        activeChar.sendMessage("Incorrect monster template.");
        return;
      }
      int respawnTime = spawn.getRespawnDelay();
      target.deleteMe();
      spawn.stopRespawn();
      try
      {
        // L2MonsterInstance mob = new L2MonsterInstance(monsterTemplate,
        // template1);
        spawn = new L2Spawn(template1);
        spawn.setLoc(activeChar.getLoc());
        spawn.setAmount(1);
        spawn.setReflection(activeChar.getReflection().getId());
        spawn.setRespawnDelay(respawnTime);
        spawn.init();
        activeChar.sendMessage("Created " + template1.name + " on " + target.getObjectId() + ".");
      }
      catch(Exception e)
      {
        activeChar.sendMessage("Target is not in game.");
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.