/**
   * Method dropAttackable.
   *
   * @param attackable NpcInstance
   * @param killer Player
   */
  public void dropAttackable(NpcInstance attackable, Player killer) {
    if (killer.isInOlympiadMode()
        || killer.isCursedWeaponEquipped()
        || (_cursedWeapons.length == 0)
        || (killer.getReflection() != ReflectionManager.DEFAULT)) {
      return;
    }

    synchronized (_cursedWeapons) {
      CursedWeapon[] cursedWeapons = new CursedWeapon[0];

      for (CursedWeapon cw : _cursedWeapons) {
        if (cw.isActive()) {
          continue;
        }

        cursedWeapons = ArrayUtils.add(cursedWeapons, cw);
      }

      if (cursedWeapons.length > 0) {
        CursedWeapon cw = cursedWeapons[Rnd.get(cursedWeapons.length)];

        if (Rnd.get(100000000) <= cw.getDropRate()) {
          cw.create(attackable, killer);
        }
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (command.startsWith("start1")) {
      Reflection r = player.getActiveReflection();
      if (r != null) {
        if (player.canReenterInstance(instanceId)) {
          player.teleToLocation(r.getTeleportLoc(), r);
        }
      } else if (player.canEnterInstance(193)) {
        ReflectionUtils.enterReflection(player, new AltarShilen(), instanceId);
      }
    } else if (command.startsWith("start2")) {

      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar1");
        party.setVar("Altar2", "true", -1);
        party.teleToLocation(FLOOR2, player.getReflection());
      }
    } else if (command.startsWith("start3")) {
      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar2");
        party.setVar("Altar3", "true", -1);
        party.teleToLocation(FLOOR3, player.getReflection());
      }

    } else if (command.startsWith("exit")) {
      for (Player party : GameObjectsStorage.getAllPlayersForIterate()) {
        party.unsetVar("Altar3");
        party.teleToLocation(OFF, 0);
      }
    } else {
      super.onBypassFeedback(player, command);
    }
  }
  /**
   * Method onBypassFeedback.
   *
   * @param npc NpcInstance
   * @param player Player
   * @param command String
   * @see lineage2.gameserver.handlers.IBypassHandler#onBypassFeedback(NpcInstance, Player, String)
   */
  @Override
  public void onBypassFeedback(NpcInstance npc, Player player, String command) {
    Reflection r = player.getReflection();
    r.startCollapseTimer(60000);
    player.teleToLocation(r.getReturnLoc(), 0);

    if (command.length() > 22) {
      try {
        int val = Integer.parseInt(command.substring(22));
        npc.showChatWindow(player, val);
      } catch (NumberFormatException nfe) {
        String filename = command.substring(22).trim();

        if (filename.length() > 0) {
          npc.showChatWindow(player, filename);
        }
      }
    }
  }