コード例 #1
0
  /**
   * Method activate.
   *
   * @param player Player
   * @param item ItemInstance
   */
  public void activate(Player player, ItemInstance item) {
    if ((player == null) || player.isInOlympiadMode()) {
      return;
    }

    CursedWeapon cw = _cursedWeaponsMap.get(item.getId());

    if (cw == null) {
      return;
    }

    if (player.isCursedWeaponEquipped()) {
      if (player.getCursedWeaponEquippedId() != item.getId()) {
        CursedWeapon cw2 = _cursedWeaponsMap.get(player.getCursedWeaponEquippedId());
        cw2.setNbKills(cw2.getStageKills() - 1);
        cw2.increaseKills();
      }

      endOfLife(cw);
      player.getInventory().destroyItem(item, 1);
    } else if (cw.getTimeLeft() > 0) {
      cw.activate(player, item);
      saveData(cw);
      announce(
          new SystemMessage(SystemMessage.THE_OWNER_OF_S2_HAS_APPEARED_IN_THE_S1_REGION)
              .addZoneName(player.getLoc())
              .addString(cw.getName()));
    } else {
      endOfLife(cw);
      player.getInventory().destroyItem(item, 1);
    }
  }
コード例 #2
0
  /**
   * Method dropPlayer.
   *
   * @param player Player
   */
  public void dropPlayer(Player player) {
    CursedWeapon cw = _cursedWeaponsMap.get(player.getCursedWeaponEquippedId());

    if (cw == null) {
      return;
    }

    if (cw.dropIt(null, null, player)) {
      saveData(cw);
      announce(
          new SystemMessage(SystemMessage.S2_WAS_DROPPED_IN_THE_S1_REGION)
              .addZoneName(player.getLoc())
              .addItemName(cw.getItemId()));
    } else {
      endOfLife(cw);
    }
  }
コード例 #3
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (command.startsWith("teleport_harnak")) {
      if ((player.getLevel() >= 85) && player.isAwaking()) {
        player.teleToLocation(-114712, 147848, -7740);
      } else {
        showChatWindow(player, "default/33344-noreq.htm");
      }
    }

    if (command.startsWith("teleport_first_floor")) {
      player.teleToLocation(-114712, 147848, -7740);
    }

    if (command.startsWith("teleport_second_floor")) {
      player.teleToLocation(-114712, 149160, -10800);
    }

    if (command.startsWith("teleport_third_floor")) {
      player.teleToLocation(-114728, 183288, -13860);
    }

    if (command.startsWith("teleport_outside")) {
      player.teleToLocation(-116160, 236370, -3088);
    }

    if (command.startsWith("teleport_next")) {
      List<int[]> lst = Arrays.asList(cycleEndTeleports);

      if (lst.contains(getId())) {
        player.teleToLocation(teleCoords.get(Integer.valueOf(getId() - 7)));
      } else {
        player.teleToLocation(teleCoords.get(Integer.valueOf(getId() + 1)));
      }
    }

    if (command.startsWith("teleport_prev")) {
      List<int[]> lst = Arrays.asList(cycleStartTeleports);

      if (lst.contains(getId())) {
        player.teleToLocation(teleCoords.get(Integer.valueOf(getId() + 7)));
      } else {
        player.teleToLocation(teleCoords.get(Integer.valueOf(getId() - 1)));
      }
    }

    if (command.startsWith("key_altar")) {
      if (player.getInventory().getItemByItemId(SEALED_HARNAK_KEY) != null) {
        if (HarnakUndegroundManager.getInstance().addSecondStagePoint(getId(), player)) {
          showChatWindow(player, "default/altar-ok.htm");
          player.getInventory().removeItemByItemId(30429, 1);
          sayScreenMessage(player);

          if (getNpcState() == 0) {
            ThreadPoolManager.getInstance().schedule(new runNpcStateChangeSecond(), 1000L);
          }

          NpcInstance Noktum =
              NpcUtils.spawnSingle(
                  NOKTUM,
                  player.getLoc().getX() + 15,
                  player.getLoc().getY(),
                  player.getLoc().getZ(),
                  1800000L);
          Noktum.addListener(_deathListener);
        } else if (player.isInParty() && player.getParty().isLeader(player)) {
          sayScreenMessage(player);
          NpcInstance Noktum =
              NpcUtils.spawnSingle(
                  NOKTUM,
                  player.getLoc().getX() + 15,
                  player.getLoc().getY(),
                  player.getLoc().getZ(),
                  1800000L);
          Noktum.addListener(_deathListener);
        } else {
          showChatWindow(player, "default/altar-no.htm");
        }
      } else {
        showChatWindow(player, "default/" + getId() + "-1.htm");
      }
    }

    if (command.startsWith("key_prison")) {
      if (player.getInventory().getItemByItemId(HARNAK_KEY) != null) {
        if (HarnakUndegroundManager.getInstance().addThirdStagePoint(getId(), player)) {
          showChatWindow(player, "default/prison-ok.htm");
          player.getInventory().removeItemByItemId(30430, 1);
          sayScreenMessage(player);

          if (getNpcState() == 0) {
            ThreadPoolManager.getInstance().schedule(new runNpcStateChangeThird(), 1000L);
          }

          NpcInstance demonikNoktum =
              NpcUtils.spawnSingle(
                  DEMONIC_NOKTUM,
                  player.getLoc().getX() + 15,
                  player.getLoc().getY(),
                  player.getLoc().getZ(),
                  1800000L);
          demonikNoktum.addListener(_deathListener);
        } else if (player.isInParty() && player.getParty().isLeader(player)) {
          sayScreenMessage(player);
          NpcInstance demonikNoktum =
              NpcUtils.spawnSingle(
                  DEMONIC_NOKTUM,
                  player.getLoc().getX() + 15,
                  player.getLoc().getY(),
                  player.getLoc().getZ(),
                  1800000L);
          demonikNoktum.addListener(_deathListener);
        } else {
          showChatWindow(player, "default/prison-no.htm");
        }
      } else {
        showChatWindow(player, "default/" + getId() + "-1.htm");
      }
    } else {
      super.onBypassFeedback(player, command);
    }
  }