Esempio n. 1
0
 /**
  * Method useVoicedCommand.
  *
  * @param command String
  * @param player Player
  * @param args String
  * @return boolean * @see
  *     lineage2.gameserver.handler.voicecommands.IVoicedCommandHandler#useVoicedCommand(String,
  *     Player, String)
  */
 @Override
 public boolean useVoicedCommand(String command, Player player, String args) {
   if (!Config.ALT_DEBUG_ENABLED) {
     return false;
   }
   if (player.isDebug()) {
     player.setDebug(false);
     player.sendMessage(new CustomMessage("voicedcommandhandlers.Debug.Disabled", player));
   } else {
     player.setDebug(true);
     player.sendMessage(new CustomMessage("voicedcommandhandlers.Debug.Enabled", player));
   }
   return true;
 }
  @Override
  public String onEvent(String event, QuestState qs, NpcInstance npc) {
    final Player player = qs.getPlayer();

    switch (event) {
      case "33155-9.htm":
        SupportMagic.getSupportMagic(npc, player);
        break;

      case "33155-10.htm":
        SupportMagic.getSupportServitorMagic(npc, player);
        break;

      case "advanceCond3":
        if (qs.getCond() != 3) {
          qs.setCond(3);
        }
        return null;

      case "teleportCruma":
        qs.setCond(1);
        qs.setState(STARTED);
        qs.playSound(SOUND_ACCEPT);
        player.teleToLocation(17192, 114173, -3439);
        return null;

      case "33163-8.htm":
        if (qs.getQuestItemsCount(TRESURE_TOOL) == 0) {
          qs.giveItems(TRESURE_TOOL, 30);
          qs.setCond(2);
        } else {
          return "33163-12.htm";
        }
        break;

      case "EnterInstance":
        if (player.getParty() == null) {
          player.sendMessage("You cannot enter without party!"); // pts message?
          return null;
        }
        for (Player member : player.getParty().getPartyMembers()) {
          final QuestState state = member.getQuestState(Q00480_AnotherLegacyOfCrumaTower.class);

          if ((state == null) || (state.getCond() != 3)) {
            // nothing as I've seen everybody can enter this instance
          } else if (state.getCond() == 3) {
            state.setCond(4);
          }
        }
        ReflectionUtils.enterReflection(player, 198);
        return null;

      case "LeaveInstance":
        player.teleToLocation(17192, 114173, -3439, ReflectionManager.DEFAULT);
        return null;
    }

    return event;
  }
Esempio n. 3
0
  /**
   * Method useAdminCommand.
   *
   * @param command String
   * @param wordList String[]
   * @param fullString String
   * @param activeChar Player
   * @return boolean
   * @see lineage2.gameserver.handlers.IAdminCommandHandler#useAdminCommand(String, String[],
   *     String, Player)
   */
  @Override
  public boolean useAdminCommand(
      String command, String[] wordList, String fullString, Player activeChar) {
    if (!activeChar.getPlayerAccess().CanKick) {
      return false;
    }

    switch (command) {
      case "admin_disconnect":
      case "admin_kick":
        final Player player;

        if (wordList.length == 1) {
          GameObject target = activeChar.getTarget();

          if (target == null) {
            activeChar.sendMessage("Select character or specify player name.");
            break;
          }

          if (!target.isPlayer()) {
            activeChar.sendPacket(new SystemMessage(SystemMessage.INVALID_TARGET));
            break;
          }

          player = (Player) target;
        } else {
          player = World.getPlayer(wordList[1]);

          if (player == null) {
            activeChar.sendMessage("Character " + wordList[1] + " not found in game.");
            break;
          }
        }

        if (player.getObjectId() == activeChar.getObjectId()) {
          activeChar.sendMessage("You can't logout your character.");
          break;
        }

        activeChar.sendMessage("Character " + player.getName() + " disconnected from server.");

        if (player.isInOfflineMode()) {
          player.setOfflineMode(false);
          player.kick();
          return true;
        }

        player.sendMessage("You where kicked by a GM.");
        player.sendPacket(
            new SystemMessage(
                SystemMessage.YOU_HAVE_BEEN_DISCONNECTED_FROM_THE_SERVER_PLEASE_LOGIN_AGAIN));
        ThreadPoolManager.getInstance()
            .schedule(
                new RunnableImpl() {
                  @Override
                  public void runImpl() {
                    player.kick();
                  }
                },
                500);
        break;
    }

    return true;
  }