private final synchronized void enterInstance(L2PcInstance player) {
    // check for existing instances for this player
    InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
    if (world != null) {
      if (world.templateId != INSTANCE_ID) {
        player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
        return;
      }
      Instance inst = InstanceManager.getInstance().getInstance(world.instanceId);
      if (inst != null) {
        teleportPlayer(player, TELEPORT, world.instanceId);
      }
      return;
    }
    // New instance
    final int instanceId =
        InstanceManager.getInstance().createDynamicInstance("PailakaSongOfIceAndFire.xml");

    world = new InstanceWorld();
    world.instanceId = instanceId;
    world.templateId = INSTANCE_ID;
    InstanceManager.getInstance().addWorld(world);

    world.allowed.add(player.getObjectId());
    teleportPlayer(player, TELEPORT, instanceId);
  }
Ejemplo n.º 2
0
  private boolean checkTeleport(L2PcInstance player) {
    final L2Party party = player.getParty();

    if (party == null) {
      return false;
    }

    if (!party.isLeader(player)) {
      player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER);
      return false;
    }

    for (L2PcInstance partyMember : party.getMembers()) {
      if (partyMember.getLevel() < 78) {
        final SystemMessage sm =
            SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      if (!Util.checkIfInRange(500, player, partyMember, true)) {
        final SystemMessage sm =
            SystemMessage.getSystemMessage(
                SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      if (InstanceManager.getInstance().getPlayerWorld(player) != null) {
        final SystemMessage sm =
            SystemMessage.getSystemMessage(
                SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      Long reentertime =
          InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
      if (System.currentTimeMillis() < reentertime) {
        SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }

      if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1) {
        SystemMessage sm =
            SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT);
        sm.addPcName(partyMember);
        party.broadcastPacket(sm);
        return false;
      }
    }
    return true;
  }
Ejemplo n.º 3
0
  /** @param instanceId The id of the instance zone the object is in - id 0 is global */
  public void setInstanceId(int instanceId) {
    if (_instanceId == instanceId) return;

    Instance oldI = InstanceManager.getInstance().getInstance(_instanceId);
    Instance newI = InstanceManager.getInstance().getInstance(instanceId);

    if (newI == null) return;

    if (this instanceof L2PcInstance) {
      if (_instanceId > 0 && oldI != null) {
        oldI.removePlayer(getObjectId());
        if (oldI.isShowTimer()) {
          int startTime = (int) ((System.currentTimeMillis() - oldI.getInstanceStartTime()) / 1000);
          int endTime = (int) ((oldI.getInstanceEndTime() - oldI.getInstanceStartTime()) / 1000);
          if (oldI.isTimerIncrease())
            sendPacket(
                new ExSendUIEvent(this, true, true, startTime, endTime, oldI.getTimerText()));
          else
            sendPacket(
                new ExSendUIEvent(this, true, false, endTime - startTime, 0, oldI.getTimerText()));
        }
      }
      if (instanceId > 0) {
        newI.addPlayer(getObjectId());
        if (newI.isShowTimer()) {
          int startTime = (int) ((System.currentTimeMillis() - newI.getInstanceStartTime()) / 1000);
          int endTime = (int) ((newI.getInstanceEndTime() - newI.getInstanceStartTime()) / 1000);
          if (newI.isTimerIncrease())
            sendPacket(
                new ExSendUIEvent(this, false, true, startTime, endTime, newI.getTimerText()));
          else
            sendPacket(
                new ExSendUIEvent(this, false, false, endTime - startTime, 0, newI.getTimerText()));
        }
      }

      if (((L2PcInstance) this).getPet() != null)
        ((L2PcInstance) this).getPet().setInstanceId(instanceId);
    } else if (this instanceof L2Npc) {
      if (_instanceId > 0 && oldI != null) oldI.removeNpc(((L2Npc) this));
      if (instanceId > 0) newI.addNpc(((L2Npc) this));
    }

    _instanceId = instanceId;

    // If we change it for visible objects, me must clear & revalidates knownlists
    if (_isVisible && _knownList != null) {
      if (this instanceof L2PcInstance) {

        // We don't want some ugly looking disappear/appear effects, so don't update
        // the knownlist here, but players usually enter instancezones through teleporting
        // and the teleport will do the revalidation for us.
      } else {
        decayMe();
        spawnMe();
      }
    }
  }
Ejemplo n.º 4
0
  protected void finishInstance(InstanceWorld world, int duration) {
    final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());

    if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_FINISH) {
      handleReenterTime(world);
    }

    if (duration == 0) {
      InstanceManager.getInstance().destroyInstance(inst.getId());
    } else if (duration > 0) {
      inst.setDuration(duration);
      inst.setEmptyDestroyTime(0);
    }
  }
Ejemplo n.º 5
0
 @Override
 public void run() {
   try {
     switch (_duel.checkEndDuelCondition()) {
       case Canceled:
         {
           // do not schedule duel end if it was interrupted
           setFinished(true);
           _duel.endDuel(DuelResult.Canceled);
           break;
         }
       case Continue:
         {
           ThreadPoolManager.getInstance().scheduleGeneral(this, 1000);
           break;
         }
       default:
         {
           setFinished(true);
           playKneelAnimation();
           ThreadPoolManager.getInstance()
               .scheduleGeneral(
                   new ScheduleEndDuelTask(_duel, _duel.checkEndDuelCondition()), 5000);
           InstanceManager.getInstance().destroyInstance(_duel.getDueldInstanceId());
           break;
         }
     }
   } catch (Exception e) {
     _log.log(Level.SEVERE, "There has been a problem while runing a duel task!", e);
   }
 }
Ejemplo n.º 6
0
  public void setReenterTime(InstanceWorld world) {
    if (world instanceof DPFWorld) {
      // Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
      Calendar reenter;
      Calendar now = Calendar.getInstance();
      Calendar reenterPointWed = (Calendar) now.clone();
      reenterPointWed.set(Calendar.AM_PM, Calendar.AM);
      reenterPointWed.set(Calendar.MINUTE, RESET_MIN);
      reenterPointWed.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
      reenterPointWed.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
      Calendar reenterPointSat = (Calendar) reenterPointWed.clone();
      reenterPointSat.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);

      if (now.after(reenterPointSat)) {
        reenterPointWed.add(Calendar.WEEK_OF_MONTH, 1);
        reenter = (Calendar) reenterPointWed.clone();
      } else {
        reenter = (Calendar) reenterPointSat.clone();
      }

      SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
      sm.addInstanceName(world.getTemplateId());
      // set instance reenter time for all allowed players
      for (int objectId : world.getAllowed()) {
        L2PcInstance player = L2World.getInstance().getPlayer(objectId);
        if ((player != null) && player.isOnline()) {
          InstanceManager.getInstance()
              .setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis());
          player.sendPacket(sm);
        }
      }
    }
  }
Ejemplo n.º 7
0
  @Override
  public String onFirstTalk(L2Npc npc, L2PcInstance player) {
    final MDWorld world = (MDWorld) InstanceManager.getInstance().getWorld(npc.getInstanceId());
    final QuestState qs =
        player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName());
    String htmltext = null;

    if (qs.isCond(1)) {
      if (world.deskSpawns.get(world.randomDesk) == npc) {
        qs.setCond(2);
        giveItems(player, THE_WAR_OF_GODS_AND_GIANTS, 1);
        world.thiefSpawns = spawnGroup("thiefs", world.getInstanceId());
        showOnScreenMsg(
            player,
            NpcStringId.WATCH_OUT_YOU_ARE_BEING_ATTACKED,
            ExShowScreenMessage.TOP_CENTER,
            5000);
        startQuestTimer("assist_player", 2000, world.toyron, player);
        htmltext = "desk_correct.html";
      } else {
        htmltext = "desk_wrong.html";
      }
    }
    return htmltext;
  }
Ejemplo n.º 8
0
  protected void enterInstance(
      L2PcInstance player, InstanceWorld instance, String template, int templateId) {
    final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
    if (world != null) {
      if (world.getTemplateId() == templateId) {
        onEnterInstance(player, world, false);

        final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
        if (inst.isRemoveBuffEnabled()) {
          handleRemoveBuffs(player, world);
        }
        return;
      }
      player.sendPacket(
          SystemMessageId
              .YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
      return;
    }

    if (checkConditions(player, templateId)) {
      instance.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
      instance.setTemplateId(templateId);
      instance.setStatus(0);
      InstanceManager.getInstance().addWorld(instance);
      onEnterInstance(player, instance, true);

      final Instance inst = InstanceManager.getInstance().getInstance(instance.getInstanceId());
      if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER) {
        handleReenterTime(instance);
      }

      if (inst.isRemoveBuffEnabled()) {
        handleRemoveBuffs(instance);
      }

      if (Config.DEBUG_INSTANCES) {
        _log.info(
            "Instance "
                + inst.getName()
                + " ("
                + instance.getTemplateId()
                + ") has been created by player "
                + player.getName());
      }
    }
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance talker) {
    final QuestState qs =
        talker.getQuestState(Q00196_SevenSignsSealOfTheEmperor.class.getSimpleName());
    String htmltext = getNoQuestMsg(talker);
    if (qs == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case PROMISE_OF_MAMMON:
        {
          if (qs.isCond(3) || qs.isCond(4)) {
            enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID);
            return "";
          }
          break;
        }
      case LEON:
        {
          if (qs.getCond() >= 3) {
            takeItems(talker, SACRED_SWORD_OF_EINHASAD, -1);
            InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker);
            world.removeAllowed(talker.getObjectId());
            talker.teleToLocation(EXIT, 0);
            htmltext = "32587-01.html";
          }
          break;
        }
      case DISCIPLES_GATEKEEPER:
        {
          if (qs.getCond() >= 3) {
            InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
            if (tmpworld instanceof DNPWorld) {
              DNPWorld world = (DNPWorld) tmpworld;
              openDoor(DISCIPLES_NECROPOLIS_DOOR, world.getInstanceId());
              talker.showQuestMovie(12);
              startQuestTimer("FIGHT", 1000, null, talker);
            }
          }
          break;
        }
    }
    return htmltext;
  }
Ejemplo n.º 10
0
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final int instanceId = npc.getInstanceId();
    if (instanceId > 0) {
      Instance inst = InstanceManager.getInstance().getInstance(instanceId);
      InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
      inst.setSpawnLoc(EXIT_POINT);

      // Terminate instance in 10 min
      if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > 600000) {
        inst.setDuration(600000);
      }

      inst.setEmptyDestroyTime(0);

      if (world instanceof DPFWorld) {
        setReenterTime(world);
      }
      addSpawn(CUBE, -22144, 278744, -8239, 0, false, 0, false, instanceId);
    }
    return super.onKill(npc, killer, isSummon);
  }
Ejemplo n.º 11
0
  private void enterInstance(L2PcInstance player, String template) {
    InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);

    if (world != null) {
      if (world instanceof DPFWorld) {
        teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
        return;
      }
      player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
      return;
    }

    if (!checkTeleport(player)) {
      return;
    }

    world = new DPFWorld();
    world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
    world.setTemplateId(TEMPLATE_ID);
    world.addAllowed(player.getObjectId());
    world.setStatus(0);
    InstanceManager.getInstance().addWorld(world);
    teleportPlayer(player, ENTRY_POINT, world.getInstanceId());

    _log.info(
        "Tower of Infinitum - Demon Prince floor started "
            + template
            + " Instance: "
            + world.getInstanceId()
            + " created by player: "
            + player.getName());

    for (L2PcInstance partyMember : player.getParty().getMembers()) {
      teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
      partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
      world.addAllowed(partyMember.getObjectId());
    }
  }
Ejemplo n.º 12
0
  /** Teleports all players to a free arena. */
  public void teleportPlayers() {
    if (!_partyDuel) {
      return;
    }

    final String instanceName = DuelManager.getInstance().getDuelArena();
    final L2OlympiadStadiumZone zone =
        ZoneManager.getInstance()
            .getAllZones(L2OlympiadStadiumZone.class) //
            .stream()
            .filter(z -> z.getInstanceTemplate().equals(instanceName))
            .findFirst()
            .orElse(null);

    if (zone == null) {
      throw new RuntimeException("Unable to find a party duel arena!");
    }

    final List<Location> spawns = zone.getSpawns();
    _duelInstanceId = InstanceManager.getInstance().createDynamicInstance(instanceName);

    // Remove Olympiad buffers
    for (L2Npc buffer : InstanceManager.getInstance().getInstance(getDueldInstanceId()).getNpcs()) {
      if ((buffer instanceof L2OlympiadManagerInstance) && buffer.isVisible()) {
        buffer.decayMe();
      }
    }

    final Location spawn1 = spawns.get(Rnd.get(spawns.size() / 2));
    for (L2PcInstance temp : _playerA.getParty().getMembers()) {
      temp.teleToLocation(spawn1.getX(), spawn1.getY(), spawn1.getZ(), 0, _duelInstanceId, 0);
    }

    final Location spawn2 = spawns.get(Rnd.get(spawns.size() / 2, spawns.size()));
    for (L2PcInstance temp : _playerB.getParty().getMembers()) {
      temp.teleToLocation(spawn2.getX(), spawn2.getY(), spawn2.getZ(), 0, _duelInstanceId, 0);
    }
  }
 @Override
 public String onExitZone(L2Character character, L2ZoneType zone) {
   if ((character instanceof L2PcInstance)
       && !character.isDead()
       && !character.isTeleporting()
       && ((L2PcInstance) character).isOnline()) {
     InstanceWorld world = InstanceManager.getInstance().getWorld(character.getInstanceId());
     if ((world != null) && (world.templateId == INSTANCE_ID)) {
       ThreadPoolManager.getInstance()
           .scheduleGeneral(new Teleport(character, world.instanceId), 1000);
     }
   }
   return super.onExitZone(character, zone);
 }
Ejemplo n.º 14
0
  /**
   * Sets reenter time for every player in the instance.
   *
   * @param world the instance
   * @param time the time in milliseconds
   */
  protected void setReenterTime(InstanceWorld world, long time) {
    for (int objectId : world.getAllowed()) {
      InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), time);
      final L2PcInstance player = L2World.getInstance().getPlayer(objectId);
      if ((player != null) && player.isOnline()) {
        player.sendPacket(
            SystemMessage.getSystemMessage(
                    SystemMessageId
                        .INSTANT_ZONE_S1_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE)
                .addString(
                    InstanceManager.getInstance().getInstance(world.getInstanceId()).getName()));
      }
    }

    if (Config.DEBUG_INSTANCES) {
      _log.info(
          "Time restrictions has been set for player in instance ID: "
              + world.getInstanceId()
              + " ("
              + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time)
              + ")");
    }
  }
Ejemplo n.º 15
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    if (event.equals("assist_player")) {
      final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
      if ((tmpworld == null) || !(tmpworld instanceof MDWorld)) {
        return null;
      }
      final MDWorld world = (MDWorld) tmpworld;

      world.toyron.setIsRunning(true);
      if (player.isInCombat()
          && (player.getTarget() != null)
          && player.getTarget().isMonster()
          && !((L2MonsterInstance) player.getTarget()).isAlikeDead()) {
        if (world.toyron.calculateDistance(player.getTarget(), false, false) > 50) {
          world
              .toyron
              .getAI()
              .setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, player.getTarget().getLocation());
          broadcastNpcSay(
              world.toyron, ChatType.NPC_GENERAL, NpcStringId.ENOUGH_OF_THIS_COME_AT_ME);
        } else if (world.toyron.getTarget() != player.getTarget()) {
          world.toyron.addDamageHate((L2Character) player.getTarget(), 0, 1000);
        }
      } else {
        world.toyron.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
      }

      if (world.thiefSpawns.get(0).isDead() && world.thiefSpawns.get(1).isDead()) {
        final QuestState qs =
            player.getQuestState(Q10327_IntruderWhoWantsTheBookOfGiants.class.getSimpleName());
        if ((qs != null) && qs.isCond(2)) {
          qs.setCond(3, true);
          showOnScreenMsg(
              player,
              NpcStringId.TALK_TO_TOYRON_TO_RETURN_TO_THE_MUSEUM_LOBBY,
              ExShowScreenMessage.TOP_CENTER,
              5000);
        }
      } else {
        startQuestTimer("assist_player", 1000, world.toyron, player);
      }
    } else if (event.equals("enter_instance")) {
      if (npc.getId() != PANTHEON) {
        return null;
      }
      enterInstance(player, new MDWorld(), "MuseumDungeon.xml", TEMPLATE_ID);
    }
    return super.onAdvEvent(event, npc, player);
  }
Ejemplo n.º 16
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = null;
    if (npc.getId() == GK_4) {
      htmltext = checkConditions(player);

      if (htmltext == null) {
        enterInstance(player, "DemonPrince.xml");
      }
    } else if (npc.getId() == CUBE) {
      InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
      if (world instanceof DPFWorld) {
        world.removeAllowed(player.getObjectId());
        teleportPlayer(player, EXIT_POINT, 0);
      }
    }
    return htmltext;
  }
 @Override
 public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) {
   InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
   if (tmpworld instanceof DNPWorld) {
     if (npc.isScriptValue(0)) {
       if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) {
         giveItems(player, SEAL_OF_BINDING, 1);
         player.sendPacket(SystemMessageId.THE_SEALING_DEVICE_ACTIVATION_COMPLETE);
         npc.setScriptValue(1);
         startQuestTimer("FINISH", 1000, npc, player);
         cancelQuestTimer("FIGHT", npc, player);
       }
     }
     if (getRandom(100) < 50) {
       npc.doCast(SEAL_ISOLATION.getSkill());
     }
   }
   return super.onAttack(npc, player, damage, isSummon);
 }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
    final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
    if (tmpworld instanceof DNPWorld) {
      final DNPWorld world = (DNPWorld) tmpworld;
      checkDoors(npc, world);
    }

    switch (npc.getId()) {
      case LILIM_MAGUS:
      case LILIM_GREAT_MAGUS:
        {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(),
                  Say2.NPC_ALL,
                  npc.getId(),
                  NpcStringId.LORD_SHILEN_SOME_DAY_YOU_WILL_ACCOMPLISH_THIS_MISSION));
          break;
        }
      case LILIM_KNIGHT_ERRANT:
      case LILIM_KNIGHT:
      case LILIM_GUARD_KNIGHT:
        {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(),
                  Say2.NPC_ALL,
                  npc.getId(),
                  NpcStringId.WHY_ARE_YOU_GETTING_IN_OUR_WAY));
          break;
        }
      case LILIM_SLAYER:
        {
          npc.broadcastPacket(
              new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.FOR_SHILEN));
          break;
        }
    }
    return super.onKill(npc, player, isSummon);
  }
Ejemplo n.º 19
0
  protected void handleReenterTime(InstanceWorld world) {
    final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
    final List<InstanceReenterTimeHolder> reenterData = inst.getReenterData();

    long time = -1;

    for (InstanceReenterTimeHolder data : reenterData) {
      if (data.getTime() > 0) {
        time = System.currentTimeMillis() + data.getTime();
        break;
      }

      final Calendar calendar = Calendar.getInstance();
      calendar.set(Calendar.AM_PM, data.getHour() >= 12 ? 1 : 0);
      calendar.set(Calendar.HOUR, data.getHour());
      calendar.set(Calendar.MINUTE, data.getMinute());
      calendar.set(Calendar.SECOND, 0);

      if (calendar.getTimeInMillis() <= System.currentTimeMillis()) {
        calendar.add(Calendar.DAY_OF_MONTH, 1);
      }

      if (data.getDay() != null) {
        while (calendar.get(Calendar.DAY_OF_WEEK) != (data.getDay().getValue() + 1)) {
          calendar.add(Calendar.DAY_OF_MONTH, 1);
        }
      }

      if (time == -1) {
        time = calendar.getTimeInMillis();
      } else if (calendar.getTimeInMillis() < time) {
        time = calendar.getTimeInMillis();
      }
    }

    if (time > 0) {
      setReenterTime(world, time);
    }
  }
  private static final boolean validateGateCondition(L2PcInstance clanLeader, L2PcInstance player) {
    if (clanLeader.isAlikeDead()) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.isInStoreMode()) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.isRooted() || clanLeader.isInCombat()) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.isInOlympiadMode()) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.isFestivalParticipant()) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.inObserverMode()) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.isInsideZone(L2Character.ZONE_NOSUMMONFRIEND)) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    if (clanLeader.getInstanceId() > 0) {
      if (!Config.ALLOW_SUMMON_TO_INSTANCE
          || InstanceManager.getInstance().getInstance(player.getInstanceId()).isSummonAllowed()) {
        // Need retail message if there's one.
        player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
        return false;
      }
    }

    if (player.isIn7sDungeon()) {
      final int targetCabal = SevenSigns.getInstance().getPlayerCabal(clanLeader.getObjectId());
      if (SevenSigns.getInstance().isSealValidationPeriod()) {
        if (targetCabal != SevenSigns.getInstance().getCabalHighestScore()) {
          // Need retail message if there's one.
          player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
          return false;
        }
      } else {
        if (targetCabal == SevenSigns.CABAL_NULL) {
          // Need retail message if there's one.
          player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
          return false;
        }
      }
    }

    if (!TvTEvent.onEscapeUse(player.getObjectId())) {
      player.sendMessage("You on TvT Event, teleporting disabled.");
      return false;
    }

    if (!TvTEvent.onEscapeUse(clanLeader.getObjectId())) {
      // Need retail message if there's one.
      player.sendMessage("Couldn't teleport to clan leader. The requirements was not meet.");
      return false;
    }

    return true;
  }
Ejemplo n.º 21
0
  private void handleRemoveBuffs(L2PcInstance player, InstanceWorld world) {
    final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
    switch (inst.getRemoveBuffType()) {
      case ALL:
        {
          player.stopAllEffectsExceptThoseThatLastThroughDeath();

          final L2Summon pet = player.getPet();
          if (pet != null) {
            pet.stopAllEffectsExceptThoseThatLastThroughDeath();
          }

          player
              .getServitors()
              .values()
              .forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
          break;
        }
      case WHITELIST:
        {
          for (BuffInfo info : player.getEffectList().getBuffs()) {
            if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) {
              info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
            }
          }

          for (L2Summon summon : player.getServitors().values()) {
            for (BuffInfo info : summon.getEffectList().getBuffs()) {
              if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) {
                info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
              }
            }
          }

          final L2Summon pet = player.getPet();
          if (pet != null) {
            for (BuffInfo info : pet.getEffectList().getBuffs()) {
              if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) {
                info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
              }
            }
          }
          break;
        }
      case BLACKLIST:
        {
          for (BuffInfo info : player.getEffectList().getBuffs()) {
            if (inst.getBuffExceptionList().contains(info.getSkill().getId())) {
              info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
            }
          }

          for (L2Summon summon : player.getServitors().values()) {
            for (BuffInfo info : summon.getEffectList().getBuffs()) {
              if (inst.getBuffExceptionList().contains(info.getSkill().getId())) {
                info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
              }
            }
          }

          final L2Summon pet = player.getPet();
          if (pet != null) {
            for (BuffInfo info : pet.getEffectList().getBuffs()) {
              if (inst.getBuffExceptionList().contains(info.getSkill().getId())) {
                info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
              }
            }
          }
          break;
        }
    }
  }
 @Override
 public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
   final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
   if (tmpworld instanceof DNPWorld) {
     final DNPWorld world = (DNPWorld) tmpworld;
     switch (event) {
       case "FINISH":
         {
           if (getQuestItemsCount(player, SEAL_OF_BINDING) >= 4) {
             player.showQuestMovie(13);
             startQuestTimer("TELEPORT", 27000, null, player);
           }
           break;
         }
       case "TELEPORT":
         {
           player.teleToLocation(ENTER, 0);
           break;
         }
       case "FIGHT":
         {
           for (L2Npc caster : world.anakimGroup) {
             if ((caster != null) && !caster.isCastingNow()) {
               makeCast(caster, world.lilithGroup);
             }
             if ((caster != null) && (caster.getId() == ANAKIM)) {
               if (caster.isScriptValue(0)) {
                 caster.broadcastPacket(
                     new NpcSay(
                         caster.getObjectId(),
                         Say2.NPC_SHOUT,
                         caster.getId(),
                         NpcStringId
                             .YOU_SUCH_A_FOOL_THE_VICTORY_OVER_THIS_WAR_BELONGS_TO_SHILIEN));
                 caster.setScriptValue(1);
               } else if (getRandom(100) < 10) {
                 caster.broadcastPacket(
                     new NpcSay(
                         caster.getObjectId(),
                         Say2.NPC_SHOUT,
                         caster.getId(),
                         LILITH_SHOUT[getRandom(3)]));
               }
             }
           }
           for (L2Npc caster : world.lilithGroup) {
             if ((caster != null) && !caster.isCastingNow()) {
               makeCast(caster, world.anakimGroup);
             }
             if ((caster != null) && (caster.getId() == 32715)) {
               if (caster.isScriptValue(0)) {
                 caster.broadcastPacket(
                     new NpcSay(
                         caster.getObjectId(),
                         Say2.NPC_SHOUT,
                         caster.getId(),
                         NpcStringId.FOR_THE_ETERNITY_OF_EINHASAD));
                 if (Util.checkIfInRange(2000, caster, player, true)) {
                   player.sendPacket(
                       new NpcSay(
                           caster.getObjectId(),
                           Say2.TELL,
                           caster.getId(),
                           NpcStringId.MY_POWERS_WEAKENING_HURRY_AND_TURN_ON_THE_SEALING_DEVICE));
                 }
                 caster.setScriptValue(1);
               } else if (getRandom(100) < 10) {
                 switch (getRandom(3)) {
                   case 0:
                     {
                       caster.broadcastPacket(
                           new NpcSay(
                               caster.getObjectId(),
                               Say2.NPC_SHOUT,
                               caster.getId(),
                               NpcStringId
                                   .DEAR_SHILLIENS_OFFSPRINGS_YOU_ARE_NOT_CAPABLE_OF_CONFRONTING_US));
                       if (Util.checkIfInRange(2000, caster, player, true)) {
                         player.sendPacket(
                             new NpcSay(
                                 caster.getObjectId(),
                                 Say2.TELL,
                                 caster.getId(),
                                 NpcStringId.ALL_4_SEALING_DEVICES_MUST_BE_TURNED_ON));
                       }
                       break;
                     }
                   case 1:
                     {
                       caster.broadcastPacket(
                           new NpcSay(
                               caster.getObjectId(),
                               Say2.NPC_SHOUT,
                               caster.getId(),
                               NpcStringId.ILL_SHOW_YOU_THE_REAL_POWER_OF_EINHASAD));
                       if (Util.checkIfInRange(2000, caster, player, true)) {
                         player.sendPacket(
                             new NpcSay(
                                 caster.getObjectId(),
                                 Say2.TELL,
                                 caster.getId(),
                                 NpcStringId
                                     .LILITHS_ATTACK_IS_GETTING_STRONGER_GO_AHEAD_AND_TURN_IT_ON));
                       }
                       break;
                     }
                   case 2:
                     {
                       caster.broadcastPacket(
                           new NpcSay(
                               caster.getObjectId(),
                               Say2.NPC_SHOUT,
                               caster.getId(),
                               NpcStringId
                                   .DEAR_MILITARY_FORCE_OF_LIGHT_GO_DESTROY_THE_OFFSPRINGS_OF_SHILLIEN));
                       if (Util.checkIfInRange(2000, caster, player, true)) {
                         player.sendPacket(
                             new NpcSay(
                                     caster.getObjectId(),
                                     Say2.TELL,
                                     caster.getId(),
                                     NpcStringId.DEAR_S1_GIVE_ME_MORE_STRENGTH)
                                 .addStringParameter(player.getName()));
                       }
                       break;
                     }
                 }
               }
             }
             startQuestTimer("FIGHT", 1000, null, player);
           }
           break;
         }
     }
   }
   return super.onAdvEvent(event, npc, player);
 }
Ejemplo n.º 23
0
 /**
  * Spawns group of instance NPC's
  *
  * @param groupName the name of group from XML definition to spawn
  * @param instanceId the instance ID
  * @return list of spawned NPC's
  */
 protected List<L2Npc> spawnGroup(String groupName, int instanceId) {
   return InstanceManager.getInstance().getInstance(instanceId).spawnGroup(groupName);
 }
  @Override
  public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = player.getQuestState(qn);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    final int cond = st.getInt("cond");
    if (event.equalsIgnoreCase("enter")) {
      enterInstance(player);
      return null;
    } else if (event.equalsIgnoreCase("32497-03.htm")) {
      if (cond == 0) {
        st.set("cond", "1");
        st.setState(State.STARTED);
        st.playSound("ItemSound.quest_accept");
      }
    } else if (event.equalsIgnoreCase("32500-06.htm")) {
      if (cond == 1) {
        st.set("cond", "2");
        st.playSound("ItemSound.quest_itemget");
        st.giveItems(SWORD, 1);
        st.giveItems(BOOK1, 1);
      }
    } else if (event.equalsIgnoreCase("32507-04.htm")) {
      if (cond == 3) {
        st.set("cond", "4");
        st.playSound("ItemSound.quest_middle");
        st.takeItems(SWORD, -1);
        st.takeItems(WATER_ESSENCE, -1);
        st.takeItems(BOOK2, -1);
        st.giveItems(BOOK3, 1);
        st.giveItems(ENH_SWORD1, 1);
      }
    } else if (event.equalsIgnoreCase("32507-08.htm")) {
      if (cond == 6) {
        st.set("cond", "7");
        st.playSound("ItemSound.quest_itemget");
        st.takeItems(ENH_SWORD1, -1);
        st.takeItems(BOOK5, -1);
        st.takeItems(FIRE_ESSENCE, -1);
        st.giveItems(ENH_SWORD2, 1);
        st.giveItems(BOOK6, 1);
      }
    } else if (event.equalsIgnoreCase("32510-02.htm")) {
      st.unset("cond");
      st.playSound("ItemSound.quest_finish");
      st.exitQuest(false);

      Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId());
      inst.setDuration(EXIT_TIME * 60000);
      inst.setEmptyDestroyTime(0);

      if (inst.containsPlayer(player.getObjectId())) {
        player.setVitalityPoints(20000, true);
        st.addExpAndSp(810000, 50000);
        for (int id : REWARDS) {
          st.giveItems(id, 1);
        }
      }
    }
    return event;
  }
Ejemplo n.º 25
0
  /**
   * Setup new parameters for this zone
   *
   * @param name
   * @param value
   */
  public void setParameter(String name, String value) {
    _checkAffected = true;

    // Zone name
    if (name.equals("name")) {
      _name = value;
    } else if (name.equals("instanceId")) {
      _instanceId = Integer.parseInt(value);
    } else if (name.equals("instanceTemplate")) {
      _instanceTemplate = value;
      _instanceId = InstanceManager.getInstance().createDynamicInstance(value);
    }
    // Minimum level
    else if (name.equals("affectedLvlMin")) {
      _minLvl = Integer.parseInt(value);
    }
    // Maximum level
    else if (name.equals("affectedLvlMax")) {
      _maxLvl = Integer.parseInt(value);
    }
    // Affected Races
    else if (name.equals("affectedRace")) {
      // Create a new array holding the affected race
      if (_race == null) {
        _race = new int[1];
        _race[0] = Integer.parseInt(value);
      } else {
        int[] temp = new int[_race.length + 1];

        int i = 0;
        for (; i < _race.length; i++) {
          temp[i] = _race[i];
        }

        temp[i] = Integer.parseInt(value);

        _race = temp;
      }
    }
    // Affected classes
    else if (name.equals("affectedClassId")) {
      // Create a new array holding the affected classIds
      if (_class == null) {
        _class = new int[1];
        _class[0] = Integer.parseInt(value);
      } else {
        int[] temp = new int[_class.length + 1];

        int i = 0;
        for (; i < _class.length; i++) {
          temp[i] = _class[i];
        }

        temp[i] = Integer.parseInt(value);

        _class = temp;
      }
    }
    // Affected class type
    else if (name.equals("affectedClassType")) {
      if (value.equals("Fighter")) {
        _classType = 1;
      } else {
        _classType = 2;
      }
    } else if (name.equals("targetClass")) {
      _target = Enum.valueOf(InstanceType.class, value);
    } else if (name.equals("allowStore")) {
      _allowStore = Boolean.parseBoolean(value);
    } else if (name.equals("default_enabled")) {
      _enabled = Boolean.parseBoolean(value);
    } else {
      _log.info(
          getClass().getSimpleName() + ": Unknown parameter - " + name + " in zone: " + getId());
    }
  }
 @Override
 public boolean useAdminCommand(String command, L2PcInstance activeChar) {
   if (command.equals("admin_show_spawns")) {
     AdminHtml.showAdminHtml(activeChar, "spawns.htm");
   } else if (command.equalsIgnoreCase("admin_spawn_debug_menu")) {
     AdminHtml.showAdminHtml(activeChar, "spawns_debug.htm");
   } else if (command.startsWith("admin_spawn_debug_print")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     L2Object target = activeChar.getTarget();
     if (target instanceof L2Npc) {
       try {
         st.nextToken();
         int type = Integer.parseInt(st.nextToken());
         printSpawn((L2Npc) target, type);
         if (command.contains("_menu")) {
           AdminHtml.showAdminHtml(activeChar, "spawns_debug.htm");
         }
       } catch (Exception e) {
       }
     } else {
       activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
     }
   } else if (command.startsWith("admin_spawn_index")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       st.nextToken();
       int level = Integer.parseInt(st.nextToken());
       int from = 0;
       try {
         from = Integer.parseInt(st.nextToken());
       } catch (NoSuchElementException nsee) {
       }
       showMonsters(activeChar, level, from);
     } catch (Exception e) {
       AdminHtml.showAdminHtml(activeChar, "spawns.htm");
     }
   } else if (command.equals("admin_show_npcs")) {
     AdminHtml.showAdminHtml(activeChar, "npcs.htm");
   } else if (command.startsWith("admin_npc_index")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       st.nextToken();
       String letter = st.nextToken();
       int from = 0;
       try {
         from = Integer.parseInt(st.nextToken());
       } catch (NoSuchElementException nsee) {
       }
       showNpcs(activeChar, letter, from);
     } catch (Exception e) {
       AdminHtml.showAdminHtml(activeChar, "npcs.htm");
     }
   } else if (command.startsWith("admin_instance_spawns")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       st.nextToken();
       int instance = Integer.parseInt(st.nextToken());
       if (instance >= 300000) {
         final StringBuilder html =
             StringUtil.startAppend(
                 500 + 1000,
                 "<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>",
                 "<font color=\"LEVEL\">Spawns for " + String.valueOf(instance) + "</font>",
                 "</td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>",
                 "<table width=\"100%\"><tr><td width=200>NpcName</td><td width=70>Action</td></tr>");
         int counter = 0;
         int skiped = 0;
         Instance inst = InstanceManager.getInstance().getInstance(instance);
         if (inst != null) {
           for (L2Npc npc : inst.getNpcs()) {
             if (!npc.isDead()) {
               // Only 50 because of client html limitation
               if (counter < 50) {
                 StringUtil.append(
                     html,
                     "<tr><td>" + npc.getName() + "</td><td>",
                     "<a action=\"bypass -h admin_move_to "
                         + npc.getX()
                         + " "
                         + npc.getY()
                         + " "
                         + npc.getZ()
                         + "\">Go</a>",
                     "</td></tr>");
                 counter++;
               } else {
                 skiped++;
               }
             }
           }
           StringUtil.append(
               html,
               "<tr><td>Skipped:</td><td>"
                   + String.valueOf(skiped)
                   + "</td></tr></table></body></html>");
           final NpcHtmlMessage ms = new NpcHtmlMessage();
           ms.setHtml(html.toString());
           activeChar.sendPacket(ms);
         } else {
           activeChar.sendMessage("Cannot find instance " + instance);
         }
       } else {
         activeChar.sendMessage("Invalid instance number.");
       }
     } catch (Exception e) {
       activeChar.sendMessage("Usage //instance_spawns <instance_number>");
     }
   } else if (command.startsWith("admin_unspawnall")) {
     Broadcast.toAllOnlinePlayers(
         SystemMessage.getSystemMessage(SystemMessageId.NPC_SERVER_NOT_OPERATING));
     RaidBossSpawnManager.getInstance().cleanUp();
     DayNightSpawnManager.getInstance().cleanUp();
     L2World.getInstance().deleteVisibleNpcSpawns();
     AdminTable.getInstance().broadcastMessageToGMs("NPC Unspawn completed!");
   } else if (command.startsWith("admin_spawnday")) {
     DayNightSpawnManager.getInstance().spawnDayCreatures();
   } else if (command.startsWith("admin_spawnnight")) {
     DayNightSpawnManager.getInstance().spawnNightCreatures();
   } else if (command.startsWith("admin_respawnall") || command.startsWith("admin_spawn_reload")) {
     // make sure all spawns are deleted
     RaidBossSpawnManager.getInstance().cleanUp();
     DayNightSpawnManager.getInstance().cleanUp();
     L2World.getInstance().deleteVisibleNpcSpawns();
     // now respawn all
     NpcData.getInstance().load();
     SpawnTable.getInstance().load();
     RaidBossSpawnManager.getInstance().load();
     AutoSpawnHandler.getInstance().reload();
     SevenSigns.getInstance().spawnSevenSignsNPC();
     QuestManager.getInstance().reloadAllScripts();
     AdminTable.getInstance().broadcastMessageToGMs("NPC Respawn completed!");
   } else if (command.startsWith("admin_spawn_monster") || command.startsWith("admin_spawn")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       String cmd = st.nextToken();
       String id = st.nextToken();
       int respawnTime = 0;
       int mobCount = 1;
       if (st.hasMoreTokens()) {
         mobCount = Integer.parseInt(st.nextToken());
       }
       if (st.hasMoreTokens()) {
         respawnTime = Integer.parseInt(st.nextToken());
       }
       if (cmd.equalsIgnoreCase("admin_spawn_once")) {
         spawnMonster(activeChar, id, respawnTime, mobCount, false);
       } else {
         spawnMonster(activeChar, id, respawnTime, mobCount, true);
       }
     } catch (Exception e) { // Case of wrong or missing monster data
       AdminHtml.showAdminHtml(activeChar, "spawns.htm");
     }
   } else if (command.startsWith("admin_list_spawns")
       || command.startsWith("admin_list_positions")) {
     int npcId = 0;
     int teleportIndex = -1;
     try { // admin_list_spawns x[xxxx] x[xx]
       String[] params = command.split(" ");
       Pattern pattern = Pattern.compile("[0-9]*");
       Matcher regexp = pattern.matcher(params[1]);
       if (regexp.matches()) {
         npcId = Integer.parseInt(params[1]);
       } else {
         params[1] = params[1].replace('_', ' ');
         npcId = NpcData.getInstance().getTemplateByName(params[1]).getId();
       }
       if (params.length > 2) {
         teleportIndex = Integer.parseInt(params[2]);
       }
     } catch (Exception e) {
       activeChar.sendMessage("Command format is //list_spawns <npcId|npc_name> [tele_index]");
     }
     if (command.startsWith("admin_list_positions")) {
       findNPCInstances(activeChar, npcId, teleportIndex, true);
     } else {
       findNPCInstances(activeChar, npcId, teleportIndex, false);
     }
   }
   return true;
 }
Ejemplo n.º 27
0
  /** Starts the duel */
  public void startDuel() {
    if ((_playerA == null) || (_playerB == null) || _playerA.isInDuel() || _playerB.isInDuel()) {
      _playerConditions.clear();
      DuelManager.getInstance().removeDuel(this);
      return;
    }

    if (_partyDuel) {
      // Set duel state and team
      for (L2PcInstance temp : _playerA.getParty().getMembers()) {
        temp.cancelActiveTrade();
        temp.setIsInDuel(_duelId);
        temp.setTeam(Team.BLUE);
        temp.broadcastUserInfo();
        broadcastToTeam2(new ExDuelUpdateUserInfo(temp));
      }
      for (L2PcInstance temp : _playerB.getParty().getMembers()) {
        temp.cancelActiveTrade();
        temp.setIsInDuel(_duelId);
        temp.setTeam(Team.RED);
        temp.broadcastUserInfo();
        broadcastToTeam1(new ExDuelUpdateUserInfo(temp));
      }

      // Send duel packets
      broadcastToTeam1(ExDuelReady.PARTY_DUEL);
      broadcastToTeam2(ExDuelReady.PARTY_DUEL);
      broadcastToTeam1(ExDuelStart.PARTY_DUEL);
      broadcastToTeam2(ExDuelStart.PARTY_DUEL);

      // Open arena doors
      for (L2DoorInstance door :
          InstanceManager.getInstance().getInstance(getDueldInstanceId()).getDoors()) {
        if ((door != null) && !door.getOpen()) {
          door.openMe();
        }
      }
    } else {
      // Set duel state and team
      _playerA.setIsInDuel(_duelId);
      _playerA.setTeam(Team.BLUE);
      _playerB.setIsInDuel(_duelId);
      _playerB.setTeam(Team.RED);

      // Send duel Start packets
      // Send duel packets
      broadcastToTeam1(ExDuelReady.PLAYER_DUEL);
      broadcastToTeam2(ExDuelReady.PLAYER_DUEL);
      broadcastToTeam1(ExDuelStart.PLAYER_DUEL);
      broadcastToTeam2(ExDuelStart.PLAYER_DUEL);

      broadcastToTeam1(new ExDuelUpdateUserInfo(_playerB));
      broadcastToTeam2(new ExDuelUpdateUserInfo(_playerA));

      _playerA.broadcastUserInfo();
      _playerB.broadcastUserInfo();
    }

    // play sound
    broadcastToTeam1(B04_S01);
    broadcastToTeam2(B04_S01);

    // start dueling task
    ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleDuelTask(this), 1000);
  }