예제 #1
0
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {

    if (command.startsWith("admin_ride")) {
      if (activeChar.isMounted() || activeChar.getPet() != null) {
        activeChar.sendMessage("You already have a pet.");
        return false;
      }
      if (command.startsWith("admin_ride_wyvern")) {
        _petRideId = 12621;
      } else if (command.startsWith("admin_ride_strider")) {
        _petRideId = 12526;
      } else if (command.startsWith("admin_ride_wolf")) {
        _petRideId = 16041;
      } else if (command.startsWith("admin_ride_horse")) // handled using transformation
      {
        if (activeChar.isTransformed() || activeChar.isInStance())
          // FIXME: Wrong Message
          activeChar.sendMessage("You cannot mount a steed while transformed.");
        else
          TransformationManager.getInstance()
              .transformPlayer(PURPLE_MANED_HORSE_TRANSFORMATION_ID, activeChar);

        return true;
      } else if (command.startsWith("admin_ride_bike")) // handled using transformation
      {
        if (activeChar.isTransformed() || activeChar.isInStance())
          // FIXME: Wrong Message
          activeChar.sendMessage("You cannot mount a steed while transformed.");
        else
          TransformationManager.getInstance()
              .transformPlayer(JET_BIKE_TRANSFORMATION_ID, activeChar);

        return true;
      } else {
        activeChar.sendMessage("Command '" + command + "' not recognized");
        return false;
      }

      activeChar.mount(_petRideId, 0, false);

      return false;
    } else if (command.startsWith("admin_unride")) {
      if (activeChar.getTransformationId() == PURPLE_MANED_HORSE_TRANSFORMATION_ID)
        activeChar.untransform();

      if (activeChar.getTransformationId() == JET_BIKE_TRANSFORMATION_ID) activeChar.untransform();
      else activeChar.dismount();
    }
    return true;
  }
예제 #2
0
  private void transformPlayer(L2PcInstance player) {
    if (player.isTransformed() || player.isInStance()) {
      player.untransform();
    }
    if (player.isSitting()) {
      player.standUp();
    }

    player.getEffectList().stopSkillEffects(true, AbnormalType.SPEED_UP);
    player.stopSkillEffects(true, 268);
    player.stopSkillEffects(true, 298); // Rabbit Spirit Totem
    SkillData.getInstance().getSkill(_skill, 1).applyEffects(player, player);
  }
예제 #3
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    if (event.equalsIgnoreCase("transform")) {
      transformPlayer(player);
      return null;
    } else if (event.equalsIgnoreCase("untransform")) {
      player.untransform();
      return null;
    } else if (event.equalsIgnoreCase("showfinish")) {
      player.getRadar().addMarker(_randspawn[0], _randspawn[1], _randspawn[2]);
      return null;
    } else if (event.equalsIgnoreCase("signup")) {
      if (_players.contains(player)) {
        return "900103-onlist.htm";
      }
      _players.add(player);
      return "900103-signup.htm";
    } else if (event.equalsIgnoreCase("quit")) {
      player.untransform();
      if (_players.contains(player)) {
        _players.remove(player);
      }
      return "900103-quit.htm";
    } else if (event.equalsIgnoreCase("finish")) {
      if (player.isAffectedBySkill(_skill)) {
        winRace(player);
        return "900104-winner.htm";
      }
      return "900104-notrans.htm";
    }
    return htmltext;
  }
예제 #4
0
  @Override
  public boolean eventStop() {
    // Don't stop inactive event
    if (!_isactive) {
      return false;
    }

    // Set inactive
    _isactive = false;
    _isRaceStarted = false;

    // Cancel task if any
    if (_eventTask != null) {
      _eventTask.cancel(true);
      _eventTask = null;
    }
    // Untransform players
    // Teleport to event start point
    for (L2PcInstance player : _players) {
      if ((player != null) && player.isOnline()) {
        player.untransform();
        player.teleToLocation(_npc.getX(), _npc.getY(), _npc.getZ(), true);
      }
    }
    // Despawn NPCs
    for (L2Npc _npc : _npclist) {
      if (_npc != null) {
        _npc.deleteMe();
      }
    }
    _npclist.clear();
    _players.clear();
    // Announce event end
    Broadcast.toAllOnlinePlayers("* Race Event finished *");

    return true;
  }