Package com.l2jfrozen.gameserver.model.actor.instance

Examples of com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance


        for (L2Spawn spawn : unSpawnCreatures) {
          if (spawn == null)
            continue;

          spawn.stopRespawn();
          L2NpcInstance last = spawn.getLastSpawn();
          if (last != null) {
            last.deleteMe();
            i++;
          }
        }
        _log.info("DayNightSpawnManager: Removed " + i + " "
            + UnspawnLogInfo + " creatures");
View Full Code Here


          clan = null;
        }       
        else if (activeChar instanceof L2NpcInstance)
        {
          // for buff purposes, returns friendly mobs nearby and mob itself
          final L2NpcInstance npc = (L2NpcInstance) activeChar;
          if (npc.getFactionId() == null || npc.getFactionId().isEmpty())
          {
            return new L2Character[]{activeChar};
          }
          targetList.add(activeChar);
          final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values();
          //synchronized (activeChar.getKnownList().getKnownObjects())
          {
            for (L2Object newTarget : objs)
            {
              if (newTarget instanceof L2NpcInstance
                  && npc.getFactionId().equals(((L2NpcInstance) newTarget).getFactionId()))
              {
                if (!Util.checkIfInRange(getCastRange(), activeChar, newTarget, true))
                  continue;
                targetList.add((L2NpcInstance) newTarget);
              }
            }
          }
        }

        return targetList.toArray(new L2Character[targetList.size()]);
      }
      case TARGET_CORPSE_PLAYER:
      {
        if(target != null && target.isDead())
        {
          L2PcInstance player = null;

          if(activeChar instanceof L2PcInstance)
          {
            player = (L2PcInstance) activeChar;
          }

          L2PcInstance targetPlayer = null;

          if(target instanceof L2PcInstance)
          {
            targetPlayer = (L2PcInstance) target;
          }

          L2PetInstance targetPet = null;

          if(target instanceof L2PetInstance)
          {
            targetPet = (L2PetInstance) target;
          }

          if(player != null && (targetPlayer != null || targetPet != null))
          {
            boolean condGood = true;

            if(getSkillType() == SkillType.RESURRECT)
            {
              // check target is not in a active siege zone
              if(target.isInsideZone(L2Character.ZONE_SIEGE))
              {
                condGood = false;
                player.sendPacket(new SystemMessage(SystemMessageId.CANNOT_BE_RESURRECTED_DURING_SIEGE));
              }

              if(targetPlayer != null)
              {
                if(targetPlayer.isReviveRequested())
                {
                  if(targetPlayer.isRevivingPet())
                  {
                    player.sendPacket(new SystemMessage(SystemMessageId.MASTER_CANNOT_RES)); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
                  }
                  else
                  {
                    player.sendPacket(new SystemMessage(SystemMessageId.RES_HAS_ALREADY_BEEN_PROPOSED)); // Resurrection is already been proposed.
                  }
                  condGood = false;
                }
              }
              else if(targetPet != null)
              {
                if(targetPet.getOwner() != player)
                {
                  condGood = false;
                  player.sendMessage("You are not the owner of this pet");
                }
              }
            }

            if(condGood)
            {
              if(!onlyFirst)
              {
                targetList.add(target);
                return targetList.toArray(new L2Object[targetList.size()]);
              }
             
              return new L2Character[]
              {
                target
              };

            }
          }

          player = null;
          targetPlayer = null;
          targetPet = null;
        }
        activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));

        return null;
      }
      case TARGET_CORPSE_MOB:
      {
        if(!(target instanceof L2Attackable) || !target.isDead())
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
          return null;
        }

        if(!onlyFirst)
        {
          targetList.add(target);
          return targetList.toArray(new L2Object[targetList.size()]);
        }
       
        return new L2Character[]
        {
          target
        };

      }
      case TARGET_AREA_CORPSE_MOB:
      {
        if(!(target instanceof L2Attackable) || !target.isDead())
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
          return null;
        }

        if(!onlyFirst)
        {
          targetList.add(target);
        }
        else
          return new L2Character[]
          {
            target
          };

        boolean srcInArena = activeChar.isInsideZone(L2Character.ZONE_PVP) && !activeChar.isInsideZone(L2Character.ZONE_SIEGE);
        L2PcInstance src = null;

        if(activeChar instanceof L2PcInstance)
        {
          src = (L2PcInstance) activeChar;
        }

        L2PcInstance trg = null;

        int radius = getSkillRadius();

        if(activeChar.getKnownList() != null)
        {
          for(L2Object obj : activeChar.getKnownList().getKnownObjects().values())
          {
            if(obj == null)
            {
              continue;
            }

            if(!(obj instanceof L2Attackable || obj instanceof L2PlayableInstance) || ((L2Character) obj).isDead() || (L2Character) obj == activeChar)
            {
              continue;
            }

            if(!Util.checkIfInRange(radius, target, obj, true))
            {
              continue;
            }

            if(!GeoData.getInstance().canSeeTarget(activeChar, obj))
            {
              continue;
            }
           
            if(isOffensive()
              && L2Character.isInsidePeaceZone(activeChar, obj))
            {
              continue;
            }

            if(obj instanceof L2PcInstance && src != null)
            {
              trg = (L2PcInstance) obj;

              if(src.getParty() != null && trg.getParty() != null && src.getParty().getPartyLeaderOID() == trg.getParty().getPartyLeaderOID())
              {
                continue;
              }

              if(!srcInArena && !(trg.isInsideZone(L2Character.ZONE_PVP) && !trg.isInsideZone(L2Character.ZONE_SIEGE)))
              {
                if(src.getAllyId() == trg.getAllyId() && src.getAllyId() != 0)
                {
                  continue;
                }

                if(src.getClan() != null && trg.getClan() != null)
                {
                  if(src.getClan().getClanId() == trg.getClan().getClanId())
                  {
                    continue;
                  }
                }

                if(!src.checkPvpSkill(obj, this))
                {
                  continue;
                }
              }
            }
            if(obj instanceof L2Summon && src != null)
            {
              trg = ((L2Summon) obj).getOwner();

              if(src.getParty() != null && trg.getParty() != null && src.getParty().getPartyLeaderOID() == trg.getParty().getPartyLeaderOID())
              {
                continue;
              }

              if(!srcInArena && !(trg.isInsideZone(L2Character.ZONE_PVP) && !trg.isInsideZone(L2Character.ZONE_SIEGE)))
              {
                if(src.getAllyId() == trg.getAllyId() && src.getAllyId() != 0)
                {
                  continue;
                }

                if(src.getClan() != null && trg.getClan() != null)
                {
                  if(src.getClan().getClanId() == trg.getClan().getClanId())
                  {
                    continue;
                  }
                }

                if(!src.checkPvpSkill(trg, this))
                {
                  continue;
                }
              }

            }

            //check for Events
            if(trg == src)
            {
              continue;
            }
           
            //if src is in event and trg not OR viceversa:
            //to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
            if(src!=null && trg!=null)
              if( ((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!trg._inEvent && !trg._inEventCTF && !trg._inEventDM && !trg._inEventTvT && !trg._inEventVIP)) || ((trg._inEvent || trg._inEventCTF || trg._inEventDM || trg._inEventTvT || trg._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP))  ){
                continue;
              }
           
            targetList.add((L2Character) obj);
          }
        }

        if(targetList.size() == 0)
          return null;

        trg = null;
        src = null;

        return targetList.toArray(new L2Character[targetList.size()]);
      }
      case TARGET_UNLOCKABLE:
      {
        if(!(target instanceof L2DoorInstance) && !(target instanceof L2ChestInstance))
        {
          // Like L2OFF if target isn't door or chest send message of incorrect target
          activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
          return null;
        }
       
        if(!onlyFirst)
        {
          targetList.add(target);
          return targetList.toArray(new L2Object[targetList.size()]);
        }
       
        return new L2Character[]
        {
          target
        };

      }
      case TARGET_ITEM:
      {
        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        sm.addString("Target type of skill is not currently handled");
        activeChar.sendPacket(sm);
        sm = null;
        return null;
      }
      case TARGET_UNDEAD:
      {
        if(target instanceof L2NpcInstance || target instanceof L2SummonInstance)
        {
          if(!target.isUndead() || target.isDead())
          {
            activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
            return null;
          }

          if(!onlyFirst)
          {
            targetList.add(target);
          }
          else
            return new L2Character[]
            {
              target
            };

          return targetList.toArray(new L2Object[targetList.size()]);
        }
        activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
        return null;
      }
      case TARGET_AREA_UNDEAD:
      {
        L2Character cha;

        int radius = getSkillRadius();

        if(getCastRange() >= 0 && (target instanceof L2NpcInstance || target instanceof L2SummonInstance) && target.isUndead() && !target.isAlikeDead())
        {
          cha = target;

          if(!onlyFirst)
          {
            targetList.add(cha); // Add target to target list
          }
          else
            return new L2Character[]
            {
              cha
            };

        }
        else
        {
          cha = activeChar;
        }

        if(cha != null && cha.getKnownList() != null)
        {
          for(L2Object obj : cha.getKnownList().getKnownObjects().values())
          {
            if(obj == null)
            {
              continue;
            }

            if(obj instanceof L2NpcInstance)
            {
              target = (L2NpcInstance) obj;
            }
            else if(obj instanceof L2SummonInstance)
            {
              target = (L2SummonInstance) obj;
            }
            else
            {
              continue;
            }

            if(!GeoData.getInstance().canSeeTarget(activeChar, target))
            {
              continue;
            }

            if(!target.isAlikeDead()) // If target is not dead/fake death and not self
            {
              if(!target.isUndead())
              {
                continue;
              }

              if(!Util.checkIfInRange(radius, cha, obj, true))
              {
                continue;
              }

              if(!onlyFirst)
              {
                targetList.add((L2Character) obj); // Add obj to target lists
              }
              else
                return new L2Character[]
                {
                  (L2Character) obj
                };
            }
          }
        }

        if(targetList.size() == 0)
          return null;

        cha = null;

        return targetList.toArray(new L2Character[targetList.size()]);
      }
      case TARGET_ENEMY_SUMMON:
      {
        if(target != null && target instanceof L2Summon)
        {
          L2Summon targetSummon = (L2Summon) target;
          if(activeChar instanceof L2PcInstance && activeChar.getPet() != targetSummon && !targetSummon.isDead() && (targetSummon.getOwner().getPvpFlag() != 0 || targetSummon.getOwner().getKarma() > 0 || targetSummon.getOwner().isInDuel()) || targetSummon.getOwner().isInsideZone(L2Character.ZONE_PVP) && ((L2PcInstance) activeChar).isInsideZone(L2Character.ZONE_PVP))
            return new L2Character[]
            {
              targetSummon
            };

          targetSummon = null;
        }
        return null;
      }
      case TARGET_SIEGE:
      {
        if(target != null && !target.isDead() && (target instanceof L2DoorInstance || target instanceof L2ControlTowerInstance))
          return new L2Character[]
          {
            target
          };
        return null;
      }
      case TARGET_TYRANNOSAURUS:
      {
        if(target instanceof L2PcInstance)
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
          return null;
        }
       
        if(target instanceof L2MonsterInstance && (((L2MonsterInstance) target).getNpcId() == 22217 || ((L2MonsterInstance) target).getNpcId() == 22216 || ((L2MonsterInstance) target).getNpcId() == 22215))
          return new L2Character[]
          {
            target
          };
        return null;
      }
      case TARGET_AREA_AIM_CORPSE:
      {
        if(target != null && target.isDead())
          return new L2Character[]
          {
            target
          };
        return null;
      }
      // npc only for now - untested
      case TARGET_CLAN_MEMBER:
      {
        if (activeChar instanceof L2NpcInstance)
        {
          // for buff purposes, returns friendly mobs nearby and mob itself
          final L2NpcInstance npc = (L2NpcInstance) activeChar;
          if (npc.getFactionId() == null || npc.getFactionId().isEmpty())
          {
            return new L2Character[]{activeChar};
          }
          final Collection<L2Object> objs = activeChar.getKnownList().getKnownObjects().values();
          for (L2Object newTarget : objs)
          {
            if (newTarget instanceof L2NpcInstance
                && npc.getFactionId().equals(((L2NpcInstance) newTarget).getFactionId()))
            {
              if (!Util.checkIfInRange(getCastRange(), activeChar, newTarget, true))
                continue;
              if (((L2NpcInstance) newTarget).getFirstEffect(this) != null)
                continue;
View Full Code Here

  {
    if (event.equalsIgnoreCase("room1_spawn"))
    {
      for (int i = 0; i <= 5; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room1Mobs){
          _Room1Mobs.add(mob);
        }
       
      }
    }
    else if (event.equalsIgnoreCase("room2_spawn"))
    {
      for (int i = 6; i <= 6; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room2Mobs){
          _Room2Mobs.add(mob);
        }
       
      }
    }
    else if (event.equalsIgnoreCase("room1_del"))
    {
      synchronized(_Room1Mobs){
        for (L2NpcInstance mob : _Room1Mobs)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _Room1Mobs.clear();
      }     
    }
    else if (event.equalsIgnoreCase("room2_del"))
    {
      synchronized(_Room2Mobs){
        for (L2NpcInstance mob : _Room2Mobs)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _Room2Mobs.clear();
      }   
    }
    else if (event.equalsIgnoreCase("kama_spawn"))
    {
      L2NpcInstance mob = addSpawn(Config.K1_FINALBOSS_ID,Config.K1_FINALBOSS_X,Config.K1_FINALBOSS_Y,Config.K1_FINALBOSS_Z,50177,false,0);
      synchronized(_KamaMob){
        _KamaMob.add(mob)
      }
    }
    else if (event.equalsIgnoreCase("kama_del"))
    {
      synchronized(_KamaMob){
        for (L2NpcInstance mob : _KamaMob)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _KamaMob.clear();
      }   
    }
    else if (event.equalsIgnoreCase("clean"))
    {
      _KillMinion = 0;
      _KillMinion2 = 0;
      _KillMinion3 = 0;
    }
    else if (event.equalsIgnoreCase("close_room12"))
    {
      for (int i = 7; i <= 9; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Doors12Mobs){
        _Doors12Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("open_room12"))
    {
      synchronized(_Doors12Mobs){
        for (L2NpcInstance mob : _Doors12Mobs)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _Doors12Mobs.clear();
      }
    }
    else if (event.equalsIgnoreCase("minions_death"))
    {   
      cancelQuestTimer("room1_spawn", npc, null);
      cancelQuestTimer("room2_spawn", npc, null);
      startQuestTimer("room1_del", 1000, npc, null);
      startQuestTimer("room2_del", 1000, npc, null);
    }
    else if (event.equalsIgnoreCase("port_out"))
    {   
      portOutAllPlayers();
    }
    else if (event.equalsIgnoreCase("kama_death"))
    {
      cancelQuestTimers("timelimit");
      startQuestTimer("kama_del", 1000, npc, null);
      startQuestTimer("open_room12", 1000, npc, null);
      startQuestTimer("spawn_cubes", 1000, npc, null);
      startQuestTimer("clean", 1000, npc, null);
     
      startQuestTimer("port_out", 25000, npc, null);
      startQuestTimer("despawn_cubes", 26250, npc, null);
      startQuestTimer("kamaloka_unlock", 26500, npc, null);
    }
    else if (event.equalsIgnoreCase("spawn_cubes"))
    {
      L2NpcInstance cubes = addSpawn(CUBE,Config.K1_FINALBOSS_X,Config.K1_FINALBOSS_Y,Config.K1_FINALBOSS_Z,16384,false,900000); //cube out spawn
      synchronized(_Cubes){
        _Cubes.add(cubes)
      }
    }
    else if (event.equalsIgnoreCase("despawn_cubes"))
    {
      synchronized(_Cubes){
        for (L2NpcInstance cubes : _Cubes)
        {
          if (cubes != null)
            cubes.deleteMe();
        }
        _Cubes.clear();
      }
    }
    else if (event.equalsIgnoreCase("kamaloka_unlock"))
View Full Code Here

  {
    if (event.equalsIgnoreCase("room1_spawn"))
    {
      for (int i = 0; i <= 5; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room1Mobs){
          _Room1Mobs.add(mob);
        }
       
      }
    }
    else if (event.equalsIgnoreCase("room2_spawn"))
    {
      for (int i = 6; i <= 6; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room2Mobs){
          _Room2Mobs.add(mob);
        }
       
      }
    }
    else if (event.equalsIgnoreCase("room1_del"))
    {
      synchronized(_Room1Mobs){
        for (L2NpcInstance mob : _Room1Mobs)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _Room1Mobs.clear();
      }     
    }
    else if (event.equalsIgnoreCase("room2_del"))
    {
      synchronized(_Room2Mobs){
        for (L2NpcInstance mob : _Room2Mobs)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _Room2Mobs.clear();
      }   
    }
    else if (event.equalsIgnoreCase("kama_spawn"))
    {
      L2NpcInstance mob = addSpawn(Config.K2_FINALBOSS_ID,Config.K2_FINALBOSS_X,Config.K2_FINALBOSS_Y,Config.K2_FINALBOSS_Z,50177,false,0);
      synchronized(_KamaMob){
        _KamaMob.add(mob)
      }
    }
    else if (event.equalsIgnoreCase("kama_del"))
    {
      synchronized(_KamaMob){
        for (L2NpcInstance mob : _KamaMob)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _KamaMob.clear();
      }   
    }
    else if (event.equalsIgnoreCase("clean"))
    {
      _KillMinions = 0;
      _KillMinions2 = 0;
      _KillMinions3 = 0;
    }
    /*else if (event.equalsIgnoreCase("close_room12")) // Delete comment tags to enable spawn gates
    {
      for (int i = 7; i <= 9; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Doors12Mobs){
        _Doors12Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("open_room12"))
    {
      synchronized(_Doors12Mobs){
        for (L2NpcInstance mob : _Doors12Mobs)
        {
          if (mob != null)
            mob.deleteMe();
        }
        _Doors12Mobs.clear();
      }
    }*/
    else if (event.equalsIgnoreCase("minions_death"))
    {   
      cancelQuestTimer("room1_spawn", npc, null);
      cancelQuestTimer("room2_spawn", npc, null);
      startQuestTimer("room1_del", 1000, npc, null);
      startQuestTimer("room2_del", 1000, npc, null);
    }
    else if (event.equalsIgnoreCase("port_out"))
    {   
      portOutAllPlayers();
    }
    else if (event.equalsIgnoreCase("kama_death"))
    {
      cancelQuestTimers("timelimit");
      startQuestTimer("kama_del", 1000, npc, null);
      // startQuestTimer("open_room12", 1000, npc, null);
      startQuestTimer("spawn_cubes", 1000, npc, null);
      startQuestTimer("clean", 1000, npc, null);
     
      startQuestTimer("port_out", 25000, npc, null);
      startQuestTimer("despawn_cubes", 26250, npc, null);
      startQuestTimer("kamaloka_unlock", 26500, npc, null);
    }
    else if (event.equalsIgnoreCase("spawn_cubes"))
    {
      L2NpcInstance cubes = addSpawn(CUBE,Config.K2_FINALBOSS_X,Config.K2_FINALBOSS_Y,Config.K2_FINALBOSS_Z,16384,false,900000); //cube out spawn
      synchronized(_Cubes){
        _Cubes.add(cubes)
      }
    }
    else if (event.equalsIgnoreCase("despawn_cubes"))
    {
      synchronized(_Cubes){
        for (L2NpcInstance cubes : _Cubes)
        {
          if (cubes != null)
            cubes.deleteMe();
        }
        _Cubes.clear();
      }
    }
    else if (event.equalsIgnoreCase("kamaloka_unlock"))
View Full Code Here

    }
    else if (event.equalsIgnoreCase("room1_spawn"))
    {
      for (int i = 0; i <= 17; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room1Mobs)
        {
        _Room1Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("room1_spawn2"))
    {
      for (int i = 18; i <= 26; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room1Mobs)
        {
        _Room1Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("room1_spawn3"))
    {
      for (int i = 27; i <= 32; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room1Mobs)
        {
        _Room1Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("room1_spawn4"))
    {
      for (int i = 33; i <= 40; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room1Mobs)
        {
        _Room1Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("room2_spawn"))
    {
      for (int i = 41; i <= 44; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room2Mobs)
        {
        _Room2Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("room2_spawn2"))
    {
      for (int i = 45; i <= 131; i++)
      {
        L2NpcInstance mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
        synchronized(_Room2Mobs)
        {
        _Room2Mobs.add(mob);
        }
      }
    }
    else if (event.equalsIgnoreCase("room1_del"))
    {
      synchronized(_Room1Mobs){
      for (L2NpcInstance mob : _Room1Mobs)
      {
        if (mob != null)
        mob.deleteMe();
      }
        _Room1Mobs.clear();
    }

  }
    else if (event.equalsIgnoreCase("room2_del"))
    {
      synchronized(_Room2Mobs){
      for (L2NpcInstance mob : _Room2Mobs)
      {
        if (mob != null)
        mob.deleteMe();
        }
        _Room2Mobs.clear();
      }
    }
    else if (event.equalsIgnoreCase("room3_del"))
    {
      if (demon1 != null)
        demon1.deleteMe();
      if (demon2 != null)
        demon2.deleteMe();
      if (demon3 != null)
        demon3.deleteMe();
      if (demon4 != null)
        demon4.deleteMe();
      if (portrait1 != null)
        portrait1.deleteMe();
      if (portrait2 != null)
        portrait2.deleteMe();
      if (portrait3 != null)
        portrait3.deleteMe();
      if (portrait4 != null)
        portrait4.deleteMe();
      if (frintezza != null)
        frintezza.deleteMe();
      if (weakScarlet != null)
        weakScarlet.deleteMe();
      if (strongScarlet != null)
        strongScarlet.deleteMe();
     
      demon1 = null;
      demon2 = null;
      demon3 = null;
      demon4 = null;
      portrait1 = null;
      portrait2 = null;
      portrait3 = null;
      portrait4 = null;
      frintezza = null;
      weakScarlet = null;
      strongScarlet = null;
      activeScarlet = null;
    }
    else if (event.equalsIgnoreCase("clean"))
    {
      _LastAction = 0;
      _LocCycle = 0;
      _CheckDie = 0;
      _OnCheck = 0;
      _Abnormal = 0;
      _OnMorph = 0;
      _SecondMorph = 0;
      _ThirdMorph = 0;
      _KillHallAlarmDevice = 0;
      _KillDarkChoirPlayer = 0;
      _KillDarkChoirCaptain = 0;
      _PlayersInside.clear();
    }
    //else if (event.equalsIgnoreCase("close"))
    //{
      //for (int i = 25150051; i <= 25150058; i++)
        //DoorTable.getInstance().getDoor(i).closeMe();
      //for (int i = 25150061; i <= 25150070; i++)
        //DoorTable.getInstance().getDoor(i).closeMe();
     
      //DoorTable.getInstance().getDoor(25150042).closeMe();
      //DoorTable.getInstance().getDoor(25150043).closeMe();
      //DoorTable.getInstance().getDoor(25150045).closeMe();
      //DoorTable.getInstance().getDoor(25150046).closeMe();
    //}
    /*else if (event.equalsIgnoreCase("loc_check"))
    {
      Integer status = GrandBossManager.getInstance().getBossStatus(FRINTEZZA);
     
      if (status == FIGHTING)
      {
        if (!_Zone.isInsideZone(npc))
          npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
        if (npc.getX() < getXFix(171932) || npc.getX() > getXFix(176532) || npc.getY() < getYFix(-90320) || npc.getY() > getYFix(-85720) || npc.getZ() < getZFix(-5130))
          npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
      }
     
    }*/
    else if (event.equalsIgnoreCase("camera_1"))
    {
      GrandBossManager.getInstance().setBossStatus(FRINTEZZA,FIGHTING);
     
      _frintezzaDummy = addSpawn(29052,174240,-89805,-5022,16048,false,0);
      _frintezzaDummy.setIsInvul(false);
      _frintezzaDummy.setIsImobilised(true);
     
      _overheadDummy = addSpawn(29052,174232,-88020,-5110,16384,false,0);
      _overheadDummy.setIsInvul(false);
      _overheadDummy.setIsImobilised(true);
      _overheadDummy.setCollisionHeight(600);
      _Zone.broadcastPacket(new NpcInfo(_overheadDummy, null));
     
      _portraitDummy1 = addSpawn(29052, 172450, -87890, -5100, 16048,false,0);
      _portraitDummy1.setIsImobilised(true);
      _portraitDummy1.setIsInvul(false);
     
      _portraitDummy3 = addSpawn(29052, 176012, -87890, -5100, 16048,false,0);
      _portraitDummy3.setIsImobilised(true);
      _portraitDummy3.setIsInvul(false);
     
      _scarletDummy = addSpawn(29053,174232,-88020,-5110,16384,false,0);
      _scarletDummy.setIsInvul(false);
      _scarletDummy.setIsImobilised(true);
     
      startQuestTimer("camera_2", 1000, _overheadDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_2"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100));
      startQuestTimer("camera_2b", 0, _overheadDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_2b"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100));
      startQuestTimer("camera_3", 0, _overheadDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_3"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),300, 90, -10, 6500, 7000));
     
      frintezza = (L2GrandBossInstance) addSpawn(FRINTEZZA,174240,-89805,-5022,16048,false,0);
      GrandBossManager.getInstance().addBoss(frintezza);
      frintezza.setIsImobilised(true);
      frintezza.setIsInvul(false);
      frintezza.disableAllSkills();
      _Zone.updateKnownList(frintezza);
     
      demon2 = (L2MonsterInstance) addSpawn(29051, 175876, -88713, -5100, 28205,false,0);
      demon2.setIsImobilised(true);
      demon2.disableAllSkills();
      _Zone.updateKnownList(demon2);
     
      demon3 = (L2MonsterInstance) addSpawn(29051, 172608, -88702, -5100, 64817,false,0);
      demon3.setIsImobilised(true);
      demon3.disableAllSkills();
      _Zone.updateKnownList(demon3);
     
      demon1 = (L2MonsterInstance) addSpawn(29050, 175833, -87165, -5100, 35048,false,0);
      demon1.setIsImobilised(true);
      demon1.disableAllSkills();
      _Zone.updateKnownList(demon1);
     
      demon4 = (L2MonsterInstance) addSpawn(29050, 172634, -87165, -5100, 57730,false,0);
      demon4.setIsImobilised(true);
      demon4.disableAllSkills();
      _Zone.updateKnownList(demon4);
     
      startQuestTimer("camera_4", 6500, _overheadDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_4"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),1800, 90, 8, 6500, 7000));
      startQuestTimer("camera_5", 900, _frintezzaDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_5"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),140, 90, 10, 2500, 4500));
      startQuestTimer("camera_5b", 4000, _frintezzaDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_5b"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 1000));
      startQuestTimer("camera_6", 0, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_6"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 12000));
      startQuestTimer("camera_7", 1350, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_7"))
    {
      _Zone.broadcastPacket(new SocialAction(frintezza.getObjectId(),2));
      startQuestTimer("camera_8", 7000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_8"))
    {
      startQuestTimer("camera_9", 1000, frintezza, null);
      _frintezzaDummy.deleteMe();
      _frintezzaDummy = null;
    }
    else if (event.equalsIgnoreCase("camera_9"))
    {
      _Zone.broadcastPacket(new SocialAction(demon2.getObjectId(),1));
      _Zone.broadcastPacket(new SocialAction(demon3.getObjectId(),1));
      startQuestTimer("camera_9b", 400, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_9b"))
    {
      _Zone.broadcastPacket(new SocialAction(demon1.getObjectId(),1));
      _Zone.broadcastPacket(new SocialAction(demon4.getObjectId(),1));
     
      for (L2Character pc : _Zone.getCharactersInside().values())
      {
        if (pc instanceof L2PcInstance)
        {
          if (pc.getX() < getXFix(174232))
            pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 1000));
          else
            pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 1000));
        }
      }
      startQuestTimer("camera_9c", 0, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_9c"))
    {
      for (L2Character pc : _Zone.getCharactersInside().values())
      {
        if (pc instanceof L2PcInstance)
        {
          if (pc.getX() < getXFix(174232))
            pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 10000));
          else
            pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 10000));
        }
      }
      startQuestTimer("camera_10", 2000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_10"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 0, 0, 1000));
      startQuestTimer("camera_11", 0, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_11"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 25, 5500, 10000));
      _Zone.broadcastPacket(new SocialAction(frintezza.getObjectId(),3));
      _portraitDummy1.deleteMe();
      _portraitDummy3.deleteMe();
      _portraitDummy1 = null;
      _portraitDummy3 = null;
     
      startQuestTimer("camera_12", 4500, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_12"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000));
      startQuestTimer("camera_13", 700, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_13"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000));
      startQuestTimer("camera_14", 1300, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_14"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),120, 180, 45, 1500, 10000));
      _Zone.broadcastPacket(new MagicSkillUser(frintezza, frintezza, 5006, 1, 34000, 0));
      startQuestTimer("camera_16", 1500, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_16"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),520, 135, 45, 8000, 10000));
      startQuestTimer("camera_17", 7500, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_17"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),1500, 110, 25, 10000, 13000));
      startQuestTimer("camera_18", 9500, frintezza, null);
    }
    else if (event.equalsIgnoreCase("camera_18"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),930, 160, -20, 0, 1000));
      startQuestTimer("camera_18b", 0, _overheadDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_18b"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 600, 180, -25, 0, 10000));
      _Zone.broadcastPacket(new MagicSkillUser(_scarletDummy,_overheadDummy, 5004, 1, 5800, 0));
     
      weakScarlet = (L2GrandBossInstance) addSpawn(SCARLET1, 174232, -88020, -5110, 16384, false, 0);
      weakScarlet.setIsInvul(false);
      weakScarlet.setIsImobilised(true);
      weakScarlet.disableAllSkills();
      _Zone.updateKnownList(weakScarlet);
      activeScarlet = weakScarlet;
     
      /*
      startQuestTimer("camera_19",  2400, _scarletDummy, null);
      startQuestTimer("camera_19b", 5000, _scarletDummy, null);
      */
      startQuestTimer("camera_19", 5500, _scarletDummy, null);
      startQuestTimer("camera_19b", 5400, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("camera_19"))
    {
      weakScarlet.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5110));
    }
    else if (event.equalsIgnoreCase("camera_19b"))
    {
      _Zone.broadcastPacket(new SpecialCamera(_scarletDummy.getObjectId(), 800, 180, 10, 1000, 10000));
      startQuestTimer("camera_20", 2100, _scarletDummy, null);
    }
    else if (event.equalsIgnoreCase("camera_20"))
    {
      _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),300, 60, 8, 0, 10000));
      startQuestTimer("camera_21", 2000, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("camera_21"))
    {
      _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),500, 90, 10, 3000, 5000));
      startQuestTimer("camera_22", 3000, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("camera_22"))
    {
      portrait2 = (L2MonsterInstance) addSpawn(29049, 175876, -88713, -5000, 28205,false,0);
      portrait2.setIsImobilised(true);
      portrait2.disableAllSkills();
      _Zone.updateKnownList(portrait2);
     
      portrait3 = (L2MonsterInstance) addSpawn(29049, 172608, -88702, -5000, 64817,false,0);
      portrait3.setIsImobilised(true);
      portrait3.disableAllSkills();
      _Zone.updateKnownList(portrait3);
     
      portrait1 = (L2MonsterInstance) addSpawn(29048, 175833, -87165, -5000, 35048,false,0);
      portrait1.setIsImobilised(true);
      portrait1.disableAllSkills();
      _Zone.updateKnownList(portrait1);
     
      portrait4 = (L2MonsterInstance) addSpawn(29048, 172634, -87165, -5000, 57730,false,0);
      portrait4.setIsImobilised(true);
      portrait4.disableAllSkills();
      _Zone.updateKnownList(portrait4);
     
      _overheadDummy.deleteMe();
      _scarletDummy.deleteMe();
      _overheadDummy = null;
      _scarletDummy = null;
     
      startQuestTimer("camera_23", 2000, weakScarlet, null);
      startQuestTimer("start_pc", 2000, weakScarlet, null);
      //startQuestTimer("loc_check", 60000, weakScarlet, null, true);
      startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
      startQuestTimer("skill01", 10000 + Rnd.get(10000), weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("camera_23"))
    {
      demon1.setIsImobilised(false);
      demon2.setIsImobilised(false);
      demon3.setIsImobilised(false);
      demon4.setIsImobilised(false);
      demon1.enableAllSkills();
      demon2.enableAllSkills();
      demon3.enableAllSkills();
      demon4.enableAllSkills();
      portrait1.setIsImobilised(false);
      portrait2.setIsImobilised(false);
      portrait3.setIsImobilised(false);
      portrait4.setIsImobilised(false);
      portrait1.enableAllSkills();
      portrait2.enableAllSkills();
      portrait3.enableAllSkills();
      portrait4.enableAllSkills();
      weakScarlet.setIsInvul(false);
      weakScarlet.setIsImobilised(false);
      weakScarlet.enableAllSkills();
      weakScarlet.setRunning();
     
      startQuestTimer("spawn_minion", 20000, portrait1, null);
      startQuestTimer("spawn_minion", 20000, portrait2, null);
      startQuestTimer("spawn_minion", 20000, portrait3, null);
      startQuestTimer("spawn_minion", 20000, portrait4, null);
    }
    else if (event.equalsIgnoreCase("stop_pc"))
    {
      for (L2Character cha : _Zone.getCharactersInside().values())
      {
        cha.abortAttack();
        cha.abortCast();
        cha.disableAllSkills();
        cha.setTarget(null);
        cha.stopMove(null);
        cha.setIsImobilised(true);
        cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      }
    }
    else if (event.equalsIgnoreCase("stop_npc"))
    {
      _Heading = npc.getHeading();
      if (_Heading < 32768)
        _Angle = Math.abs(180 - (int)(_Heading / 182.044444444));
      else
        _Angle = Math.abs(540 - (int)(_Heading / 182.044444444));
    }
    else if (event.equalsIgnoreCase("start_pc"))
    {
      for (L2Character cha : _Zone.getCharactersInside().values())
      {
        if (cha != frintezza)
        {
          cha.enableAllSkills();
          cha.setIsImobilised(false);
        }
      }
    }
    else if (event.equalsIgnoreCase("start_npc"))
    {
      npc.setRunning();
      npc.setIsInvul(false);
    }
    else if (event.equalsIgnoreCase("morph_end"))
    {
      _OnMorph = 0;
    }
    else if (event.equalsIgnoreCase("morph_01"))
    {
      _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 2000, 15000));
      startQuestTimer("morph_02", 3000, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_02"))
    {
      _Zone.broadcastPacket(new SocialAction(weakScarlet.getObjectId(),1));
      weakScarlet.setRHandId(7903);
      startQuestTimer("morph_03", 4000, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_03"))
    {
      startQuestTimer("morph_04", 1500, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_04"))
    {
      _Zone.broadcastPacket(new SocialAction(weakScarlet.getObjectId(),4));
      L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
      if (skill != null)
        skill.getEffects(weakScarlet, weakScarlet, false, false, false);
     
      startQuestTimer("morph_end", 6000, weakScarlet, null);
      startQuestTimer("start_pc", 3000, weakScarlet, null);
      startQuestTimer("start_npc", 3000, weakScarlet, null);
      startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
      startQuestTimer("skill02", 10000 + Rnd.get(10000), weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_05a"))
    {
      _Zone.broadcastPacket(new SocialAction(frintezza.getObjectId(),4));
    }
    else if (event.equalsIgnoreCase("morph_05"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 1000));
      startQuestTimer("morph_06", 0, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_06"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 10000));
     
      //cancelQuestTimers("loc_check");
     
      _Scarlet_x = weakScarlet.getX();
      _Scarlet_y = weakScarlet.getY();
      _Scarlet_z = weakScarlet.getZ();
      _Scarlet_h = weakScarlet.getHeading();
      weakScarlet.deleteMe();
      weakScarlet = null;
      activeScarlet = null;
      weakScarlet = (L2GrandBossInstance) addSpawn(SCARLET1, _Scarlet_x, _Scarlet_y, _Scarlet_z, _Scarlet_h, false,0);
      weakScarlet.setIsInvul(false);
      weakScarlet.setIsImobilised(true);
      weakScarlet.disableAllSkills();
      weakScarlet.setRHandId(7903);
      _Zone.updateKnownList(weakScarlet);
     
      startQuestTimer("morph_07", 7000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_07"))
    {
      _Zone.broadcastPacket(new MagicSkillUser(frintezza, frintezza, 5006, 1, 34000, 0));
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),500, 70, 15, 3000, 10000));
      startQuestTimer("morph_08", 3000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_08"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),2500, 90, 12, 6000, 10000));
      startQuestTimer("morph_09", 3000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_09"))
    {
      _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 1000));
      startQuestTimer("morph_10", 0, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_10"))
    {
      _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 10000));
      startQuestTimer("morph_11", 500, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_11"))
    {
      weakScarlet.doDie(weakScarlet);
      _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),450, _Angle, 14, 8000, 8000));
     
      startQuestTimer("morph_12", 6250, weakScarlet, null);
      startQuestTimer("morph_13", 7200, weakScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_12"))
    {
      weakScarlet.deleteMe();
      weakScarlet = null;
    }
    else if (event.equalsIgnoreCase("morph_13"))
    {
      strongScarlet = (L2GrandBossInstance) addSpawn(SCARLET2, reverseXFix(_Scarlet_x), reverseYFix(_Scarlet_y), reverseZFix(_Scarlet_z), _Scarlet_h, false,0);
      strongScarlet.setIsInvul(false);
      strongScarlet.setIsImobilised(true);
      strongScarlet.disableAllSkills();
      _Zone.updateKnownList(strongScarlet);
      activeScarlet = strongScarlet;
     
      _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),450, _Angle, 12, 500, 14000));
     
      startQuestTimer("morph_14", 3000, strongScarlet, null);
      //startQuestTimer("loc_check", 60000, strongScarlet, null, true);
    }
    else if (event.equalsIgnoreCase("morph_14"))
    {
      startQuestTimer("morph_15", 5100, strongScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_15"))
    {
      _Zone.broadcastPacket(new SocialAction(strongScarlet.getObjectId(),2));
      L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
      if (skill != null)
        skill.getEffects(strongScarlet, strongScarlet, false, false, false);
     
      startQuestTimer("morph_end", 9000, strongScarlet, null);
      startQuestTimer("start_pc", 6000, strongScarlet, null);
      startQuestTimer("start_npc", 6000, strongScarlet, null);
      startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
      startQuestTimer("skill03", 10000 + Rnd.get(10000), strongScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_16"))
    {
      _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),300, _Angle - 180 , 5, 0, 7000));
      startQuestTimer("morph_17", 0, strongScarlet, null);
    }
    else if (event.equalsIgnoreCase("morph_17"))
    {
      _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),200, _Angle, 85, 4000, 10000));
      startQuestTimer("morph_17b", 7400, frintezza, null);
      startQuestTimer("morph_18", 7500, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_17b"))
    {
      frintezza.doDie(frintezza);
    }
    else if (event.equalsIgnoreCase("morph_18"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 120, 5, 0, 7000));
      startQuestTimer("morph_19", 0, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_19"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 90, 5, 5000, 15000));
      startQuestTimer("morph_20", 7000, frintezza, null);
      startQuestTimer("spawn_cubes", 7000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("morph_20"))
    {
      _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),900, 90, 25, 7000, 10000));
      startQuestTimer("start_pc", 7000, frintezza, null);
    }
    else if (event.equalsIgnoreCase("songs_play"))
    {
      if (frintezza != null && !frintezza.isDead() && _OnMorph == 0)
      {
        _OnSong = Rnd.get(1, 5);
        if(_OnSong == 3){ //to fix skill exception
          _OnSong = 2;
        }
       
        String SongName = "";
                      
        // Name of the songs are custom, named with client side description.
        switch(_OnSong)
        {
        case 1:
        SongName = "Frintezza's Healing Rhapsody";
        break;
        case 2:
        SongName = "Frintezza's Rampaging Opus";
        break;
        case 3:
        SongName = "Frintezza's Power Concerto";
        break;
        case 4:
        SongName = "Frintezza's Plagued Concerto";
        break;
        case 5:
        SongName = "Frintezza's Psycho Symphony";
        break;
        default:
        SongName = "Frintezza's Song";
        break;
        }
                    
        // Like L2OFF the skill name is printed on screen
        _Zone.broadcastPacket(new ExShowScreenMessage(SongName , 6000));
       
        if (_OnSong == 1 && _ThirdMorph == 1 && strongScarlet.getCurrentHp() < strongScarlet.getMaxHp() * 0.6 && Rnd.get(100) < 80)
        {
          _Zone.broadcastPacket(new MagicSkillUser(frintezza, frintezza, 5007, 1, 32000, 0));
          startQuestTimer("songs_effect", 5000, frintezza, null);
          startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
        }
        else if (_OnSong == 2 || _OnSong == 3)
        {
          _Zone.broadcastPacket(new MagicSkillUser(frintezza, frintezza, 5007, _OnSong, 32000, 0));
          startQuestTimer("songs_effect", 5000, frintezza, null);
          startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
        }
        else if (_OnSong == 4 && _SecondMorph == 1)
        {
          _Zone.broadcastPacket(new MagicSkillUser(frintezza, frintezza, 5007, 4, 31000, 0));
          startQuestTimer("songs_effect", 5000, frintezza, null);
          startQuestTimer("songs_play", 31000 + Rnd.get(10000), frintezza, null);
        }
        else if (_OnSong == 5 && _ThirdMorph == 1 && _Abnormal == 0)
        {
          _Abnormal = 1;
          _Zone.broadcastPacket(new MagicSkillUser(frintezza, frintezza, 5007, 5, 35000, 0));
          startQuestTimer("songs_effect", 5000, frintezza, null);
          startQuestTimer("songs_play", 35000 + Rnd.get(10000), frintezza, null);
        }
        else
          startQuestTimer("songs_play", 5000 + Rnd.get(5000), frintezza, null);
      }
    }
    else if (event.equalsIgnoreCase("songs_effect"))
    {
      L2Skill skill = SkillTable.getInstance().getInfo(5008, _OnSong);
      if (skill == null)
        return null;
     
      String SongName = "";
              
      // Name of the songs are custom, named with client side description.
      switch(_OnSong)
      {
      case 1:
      SongName = "Frintezza's Concert Hall Melody";
      break;
      case 2:
      SongName = "Frintezza's Rampaging Opus en masse";
      break;
      case 3:
      SongName = "Frintezza Power Encore";
      break;
      case 4:
      SongName = "Mournful Chorale Prelude";
      break;
      case 5:
      SongName = "Hypnotic Mazurka ";
      break;
      default:
      SongName = "Frintezza's Song";
      break;
      }
                 
      // Like L2OFF the skill name is printed on screen
      _Zone.broadcastPacket(new ExShowScreenMessage(SongName , 6000));
     
      if (_OnSong == 1 || _OnSong == 2 || _OnSong == 3)
      {
        if (frintezza != null && !frintezza.isDead() && activeScarlet != null && !activeScarlet.isDead())
          skill.getEffects(frintezza, activeScarlet, false, false, false);
      }
      else if (_OnSong == 4)
      {
        for (L2Character cha : _Zone.getCharactersInside().values())
        {
          if (cha instanceof L2PcInstance && Rnd.get(100) < 80)
          {
            skill.getEffects(frintezza, cha, false, false, false);
            cha.sendPacket(new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 4));
          }
        }
      }
      else if (_OnSong == 5)
      {
        for (L2Character cha : _Zone.getCharactersInside().values())
        {
          if (cha instanceof L2PcInstance && Rnd.get(100) < 70)
          {
            cha.abortAttack();
            cha.abortCast();
            cha.disableAllSkills();
            cha.stopMove(null);
            cha.setIsImobilised(true);
            cha.setIsParalyzed(true);
            cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
            skill.getEffects(frintezza, cha, false, false, false);
            cha.startAbnormalEffect(L2Character.ABNORMAL_EFFECT_DANCE_STUNNED);
            cha.sendPacket(new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 5));
          }
        }
        startQuestTimer("stop_effect", 25000, frintezza, null);
      }
    }
    else if (event.equalsIgnoreCase("stop_effect"))
    {
      for (L2Character cha : _Zone.getCharactersInside().values())
      {
        if (cha instanceof L2PcInstance)
        {
          cha.stopAbnormalEffect(L2Character.ABNORMAL_EFFECT_DANCE_STUNNED);
          cha.stopAbnormalEffect(L2Character.ABNORMAL_EFFECT_FLOATING_ROOT);
          cha.enableAllSkills();
          cha.setIsImobilised(false);
          cha.setIsParalyzed(false);
        }
      }
      _Abnormal = 0;
    }
    else if (event.equalsIgnoreCase("attack_stop"))
    {
      cancelQuestTimer("skill01", npc, null);
      cancelQuestTimer("skill02", npc, null);
      cancelQuestTimer("skill03", npc, null);
      cancelQuestTimer("songs_play", npc, null);
      cancelQuestTimer("songs_effect", npc, null);
     
      if (frintezza != null)
        _Zone.broadcastPacket(new MagicSkillCanceld(frintezza.getObjectId()));
    }
    else if (event.equalsIgnoreCase("check_hp"))
    {
      if (npc.isDead())
      {
        _OnMorph = 1;
        _Zone.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
       
        startQuestTimer("attack_stop", 0, frintezza, null);
        startQuestTimer("stop_pc", 0, npc, null);
        startQuestTimer("stop_npc", 0, npc, null);
        startQuestTimer("morph_16", 0, npc, null);
      }
      else
      {
        _CheckDie = _CheckDie + 10;
        if (_CheckDie < 3000)
          startQuestTimer("check_hp", 10, npc, null);
        else
        {
          _OnCheck = 0;
          _CheckDie = 0;
        }
      }
    }
    else if (event.equalsIgnoreCase("skill01"))
    {
      if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0)
      {
        int i = Rnd.get(0,1);
        L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
        if (skill != null)
        {
          weakScarlet.stopMove(null);
          //weakScarlet.setIsCastingNow(true);
          weakScarlet.doCast(skill);
        }
        startQuestTimer("skill01", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
      }
    }
    else if (event.equalsIgnoreCase("skill02"))
    {
      if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0)
      {
        int i = 0;
        if (_Abnormal == 0)
          i = Rnd.get(2,5);
        else
          i = Rnd.get(2,4);
       
        L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
        if (skill != null)
        {
          weakScarlet.stopMove(null);
          //weakScarlet.setIsCastingNow(true);
          weakScarlet.doCast(skill);
        }
        startQuestTimer("skill02", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
       
        if (i == 5)
        {
          _Abnormal = 1;
          startQuestTimer("float_effect", 4000, weakScarlet, null);
        }
      }
    }
    else if (event.equalsIgnoreCase("skill03"))
    {
      if (strongScarlet != null && !strongScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 1 && _OnMorph == 0)
      {
        int i = 0;
        if (_Abnormal == 0)
          i = Rnd.get(6,10);
        else
          i = Rnd.get(6,9);
       
        L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
        if (skill != null)
        {
          strongScarlet.stopMove(null);
          //strongScarlet.setIsCastingNow(true);
          strongScarlet.doCast(skill);
        }
        startQuestTimer("skill03", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
       
        if (i == 10)
        {
          _Abnormal = 1;
          startQuestTimer("float_effect", 3000, npc, null);
        }
      }
    }
    else if (event.equalsIgnoreCase("float_effect"))
    {
      if (npc.isCastingNow())
      {
        startQuestTimer("float_effect", 500, npc, null);
      }
      else
      {
        for (L2Character cha : _Zone.getCharactersInside().values())
        {
          if (cha instanceof L2PcInstance)
          {
            if (cha.getFirstEffect(5016) != null)
            {
              cha.abortAttack();
              cha.abortCast();
              cha.disableAllSkills();
              cha.stopMove(null);
              cha.setIsImobilised(true);
              cha.setIsParalyzed(true);
              cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
              cha.startAbnormalEffect(L2Character.ABNORMAL_EFFECT_FLOATING_ROOT);
            }
          }
        }
        startQuestTimer("stop_effect", 25000, npc, null);
      }
    }
    else if (event.equalsIgnoreCase("action"))
    {
      _Zone.broadcastPacket(new SocialAction(npc.getObjectId(),1));
    }
    else if (event.equalsIgnoreCase("bomber"))
    {
      _Bomber = 0;
    }
    else if (event.equalsIgnoreCase("room_final"))
    {
      _Zone.broadcastPacket(new CreatureSay(npc.getObjectId(),1,npc.getName(),"Exceeded his time limit, challenge failed!"));
      _Zone.oustAllPlayers();
     
      cancelQuestTimer("waiting", null, null);
      cancelQuestTimer("frintezza_despawn", npc, null);
      startQuestTimer("clean", 1000, npc, null);
      startQuestTimer("close", 1000, npc, null);
      startQuestTimer("room1_del", 1000, npc, null);
      startQuestTimer("room2_del", 1000, npc, null);
     
      GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
    }
    else if (event.equalsIgnoreCase("frintezza_despawn"))
    {
      temp = (System.currentTimeMillis() - _LastAction);
      if (temp > 900000)
      {
        _Zone.oustAllPlayers();
       
        cancelQuestTimer("waiting", npc, null);
        //cancelQuestTimer("loc_check");
        cancelQuestTimer("room_final", null, null);
        cancelQuestTimer("spawn_minion", npc, null);
        startQuestTimer("clean", 1000, npc, null);
        startQuestTimer("close", 1000, npc, null);
        startQuestTimer("attack_stop", 1000, npc, null);
        startQuestTimer("room1_del", 1000, npc, null);
        startQuestTimer("room2_del", 1000, npc, null);
        startQuestTimer("room3_del", 1000, npc, null);
        startQuestTimer("minions_despawn", 1000, npc, null);
       
        GrandBossManager.getInstance().setBossStatus(FRINTEZZA,DORMANT);
       
        cancelQuestTimer("frintezza_despawn", null, null);
      }
    }
    else if (event.equalsIgnoreCase("minions_despawn"))
    {
      synchronized(Minions){
        for (int i = 0; i < Minions.size(); i++)
        {
        L2Attackable mob = Minions.get(i);
        if (mob != null)
        mob.decayMe();
        }
        Minions.clear();
      }
    }
    else if (event.equalsIgnoreCase("spawn_minion"))
    {
      if (npc != null && !npc.isDead() && frintezza != null && !frintezza.isDead())
      {
        L2NpcInstance mob = addSpawn(npc.getNpcId()+2,npc.getX(),npc.getY(),npc.getZ(),npc.getHeading(),false,0);
        //mob.setIsRaidMinion(true);
        synchronized(Minions)
        {
          Minions.add((L2Attackable)mob);
        }
View Full Code Here

    _log.fine("Deleting all visible NPC's in Region: " + getName());
    for(L2Object obj : _visibleObjects)
    {
      if(obj instanceof L2NpcInstance)
      {
        L2NpcInstance target = (L2NpcInstance) obj;
        target.deleteMe();
        L2Spawn spawn = target.getSpawn();

        if(spawn != null)
        {
          spawn.stopRespawn();
          SpawnTable.getInstance().deleteSpawn(spawn, false);
        }

        _log.finest("Removed NPC " + target.getObjectId());

        target = null;
        spawn = null;
      }
    }if(Config.DEBUG){
View Full Code Here

  public boolean testImpl(Env env)
  {
    if(_raceIds==null || env.target==null || !(env.target instanceof L2NpcInstance))
      return false;

    L2NpcInstance target = (L2NpcInstance) env.target;
    if(target.getTemplate()!=null && target.getTemplate().race!=null ){
      return _raceIds.contains(((L2NpcInstance) env.target).getTemplate().race.ordinal()+1);
    }
    return false;
  }
View Full Code Here

            L2GrandBossInstance baium = (L2GrandBossInstance) addSpawn(LIVE_BAIUM, loc_x, loc_y, loc_z, heading, false, 0);
            if (Config.ANNOUNCE_TO_ALL_SPAWN_RB) {
                Announcements.getInstance().announceToAll("Raid boss " + baium.getName() + " spawned in world.");
            }
            GrandBossManager.getInstance().addBoss(baium);
            final L2NpcInstance _baium = baium;
            ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
                @Override
                public void run() {
                    try {
                        _baium.setCurrentHpMp(hp, mp);
                        _baium.setIsInvul(true);
                        //_baium.setIsImobilised(true);
                        _baium.broadcastPacket(new SocialAction(_baium.getObjectId(), 2));
                        startQuestTimer("baium_wakeup", 15000, _baium, null);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
View Full Code Here

                }

                npc.setRunning();

                startQuestTimer("skill_range", 500, npc, null, true);
                final L2NpcInstance baium = npc;
                ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            baium.setIsInvul(false);
                            // baium.setIsImobilised(false);
                            // for (L2NpcInstance minion : _Minions)
                            // minion.setShowSummonAnimation(false);
                            baium.getAttackByList().addAll(_Zone.getCharactersInside().values());

                        } catch (Exception e) {
                            LOGGER.info("", e);
                        }
                    }
View Full Code Here

                // 30 minutes pass with no attacks made against Baium.
                GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, AWAKE);
                npc.deleteMe();
                L2GrandBossInstance baium = (L2GrandBossInstance) addSpawn(LIVE_BAIUM, npc);
                GrandBossManager.getInstance().addBoss(baium);
                final L2NpcInstance _baium = baium;
                ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            _baium.setIsInvul(true);
                            _baium.setRunning();
                            _baium.broadcastPacket(new SocialAction(_baium.getObjectId(), 2));
                            startQuestTimer("baium_wakeup", 15000, _baium, player);
                            //_baium.setShowSummonAnimation(false);
                        } catch (Throwable e) {
                            LOGGER.info("", e);
                        }
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance

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.