/** Method runImpl. */
  @Override
  protected void runImpl() {
    Player player = getClient().getActiveChar();

    if (player == null) {
      return;
    }

    Party party = player.getParty();
    CommandChannel channel = party != null ? party.getCommandChannel() : null;

    if ((channel != null) && (channel.getChannelLeader() == player)) {
      if ((channel.getMatchingRoom() == null) && (party != null)) {
        CCMatchingRoom room =
            new CCMatchingRoom(
                player, 1, player.getLevel(), 50, party.getLootDistribution(), player.getName());
        channel.setMatchingRoom(room);
      }
    } else if ((channel != null) && !channel.getParties().contains(party)) {
      player.sendPacket(
          SystemMsg
              .THE_COMMAND_CHANNEL_AFFILIATED_PARTYS_PARTY_MEMBER_CANNOT_USE_THE_MATCHING_SCREEN);
    } else if ((party != null) && !party.isLeader(player)) {
      player.sendPacket(
          SystemMsg
              .THE_LIST_OF_PARTY_ROOMS_CAN_ONLY_BE_VIEWED_BY_A_PERSON_WHO_IS_NOT_PART_OF_A_PARTY);
    } else {
      MatchingRoomManager.getInstance().addToWaitingList(player);
      player.sendPacket(new ListPartyWaiting(_region, _allLevels == 1, _page, player));
    }
  }
  @Override
  public String onTalk(NpcInstance npc, QuestState qs) {
    if (qs.isCompleted()) {
      return "completed";
    }
    String htmltext = "noquest";
    final int cond = qs.getCond();
    final Player player = qs.getPlayer();

    if (cond == 0) {
      if (player.getLevel() < 90) {
        htmltext = "33293-02.htm";
        qs.exitCurrentQuest(true);
      } else {
        htmltext = "33293-01.htm";
      }
    } else if (cond == 1) {
      htmltext = "33293-07.htm";
    } else if ((cond == 2) || (qs.getQuestItemsCount(ShilensMark) >= 1)) {
      htmltext = "33293-08.htm";
      qs.addExpAndSp(833065000, 368800464);
      qs.giveItems(IstinasBracelet, 1);
      qs.giveItems(EnchantScrollArmor, 10);
      qs.setState(COMPLETED);
      qs.playSound(SOUND_FINISH);
      qs.exitCurrentQuest(false);
    }

    return htmltext;
  }
예제 #3
0
 /**
  * Method getRecoBonus.
  *
  * @param activeChar Player
  * @return int
  */
 public static int getRecoBonus(Player activeChar) {
   if ((activeChar != null) && activeChar.isOnline()) {
     if (activeChar.getRecomHave() == 0) {
       return 0;
     }
     int _lvl = (int) Math.ceil(activeChar.getLevel() / 10);
     int _exp = (int) Math.ceil((Math.min(100, activeChar.getRecomHave()) - 1) / 10);
     return _recoBonus[_lvl][_exp];
   }
   return 0;
 }
예제 #4
0
 /** Method getProtectionBlessing. */
 public void getProtectionBlessing() {
   Player player = getSelf();
   NpcInstance npc = getNpc();
   if (player.getKarma() > 0) {
     return;
   }
   if ((player.getLevel() > 39) || player.getClassId().isOfLevel(ClassLevel.Second)) {
     show("default/newbie_blessing_no.htm", player, npc);
     return;
   }
   npc.doCast(SkillTable.getInstance().getInfo(5182, 1), player, true);
 }
예제 #5
0
 /**
  * Method doSupportMagic.
  *
  * @param npc NpcInstance
  * @param player Player
  * @param servitor boolean
  */
 public static void doSupportMagic(NpcInstance npc, Player player, boolean servitor) {
   if (player.isCursedWeaponEquipped()) {
     return;
   }
   int lvl = player.getLevel();
   if (servitor && (player.getSummonList().getFirstServitor() == null)) {
     show("default/newbie_nosupport_servitor.htm", player, npc);
     return;
   }
   if (lvl < minSupLvl) {
     show("default/newbie_nosupport_min.htm", player, npc);
     return;
   }
   if (lvl > maxSupLvl) {
     show("default/newbie_nosupport_max.htm", player, npc);
     return;
   }
   List<Creature> target = new ArrayList<>();
   if (servitor) {
     for (Summon summon : player.getSummonList()) {
       target.add(summon);
       for (int[] buff : _summonBuff) {
         if ((lvl >= buff[0]) && (lvl <= buff[1])) {
           npc.broadcastPacket(new MagicSkillUse(npc, summon, buff[2], buff[3], 0, 0));
           npc.callSkill(SkillTable.getInstance().getInfo(buff[2], buff[3]), target, true);
         }
       }
     }
   } else {
     target.add(player);
     if (!player.isMageClass() || (player.getTemplate().getRace() == Race.orc)) {
       for (int[] buff : _warrBuff) {
         if ((lvl >= buff[0]) && (lvl <= buff[1])) {
           npc.broadcastPacket(new MagicSkillUse(npc, player, buff[2], buff[3], 0, 0));
           npc.callSkill(SkillTable.getInstance().getInfo(buff[2], buff[3]), target, true);
         }
       }
     } else {
       for (int[] buff : _mageBuff) {
         if ((lvl >= buff[0]) && (lvl <= buff[1])) {
           npc.broadcastPacket(new MagicSkillUse(npc, player, buff[2], buff[3], 0, 0));
           npc.callSkill(SkillTable.getInstance().getInfo(buff[2], buff[3]), target, true);
         }
       }
     }
   }
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState qs) {
    String htmltext = "noquest";

    if (qs == null) {
      return htmltext;
    }

    final Player player = qs.getPlayer();
    final QuestState previous = player.getQuestState(Q10315_ToThePrisonOfDarkness.class);

    if ((previous == null) || (!previous.isCompleted())) {
      if (player.getLevel() < 90) {
        qs.exitCurrentQuest(true);
        return "32946-02.htm";
      }
    } else {
      qs.exitCurrentQuest(true);
      return "32946-09.htm";
    }

    switch (qs.getState()) {
      case COMPLETED:
        htmltext = "32946-10.htm";
        break;

      case CREATED:
        htmltext = "32946-01.htm";
        break;

      case STARTED:
        if (qs.getCond() == 1) {
          htmltext = "32946-07.htm";
        } else {
          if (qs.getCond() != 2) {
            break;
          }

          htmltext = "32946-08.htm";
        }
    }

    return htmltext;
  }
예제 #7
0
  /**
   * Method onPlayerEnter.
   *
   * @param player Player
   * @see lineage2.gameserver.listener.actor.player.OnPlayerEnterListener#onPlayerEnter(Player)
   */
  @Override
  public void onPlayerEnter(Player player) {
    if (player.getClassId().level() < 3) {
      return;
    }

    if (player.getLevel() < 85) {
      return;
    }

    if (player.isAwaking()) {
      return;
    }

    if (player.getActiveSubClass().isBase() || player.getActiveSubClass().isDual()) {
      player.sendPacket(new ExShowUsmVideo(ExShowUsmVideo.Q010));
      player.sendPacket(new ExCallToChangeClass(_CA.get(player.getClassId().getId()), true));
    }
  }
  @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);
    }
  }