@Override
 public void handle(Player player, Packet packet) {
   if (player.getAttribute("cutScene") != null) {
     return;
   }
   if (player.getInterfaceAttribute("fightPitOrbs") != null) {
     return;
   }
   switch (packet.getOpcode()) {
     case OPTION_1:
       handleOption1(player, packet);
       break;
     case OPTION_2:
       handleOption2(player, packet);
       break;
     case OPTION_3:
       handleOption3(player, packet);
       break;
     case OPTION_ATTACK:
       handleOptionAttack(player, packet);
       break;
     case OPTION_SPELL:
       handleOptionSpell(player, packet);
       break;
     case OPTION_EXAMINE:
       handleOptionExamine(player, packet);
       break;
   }
 }
Ejemplo n.º 2
0
  @Override
  public void handle(Player player, Packet packet) {
    if (player.getSkills().getLevel(Skills.HITPOINTS) < 1) {
      return;
    }
    int size = packet.getLength();
    if (packet.getOpcode() == 11) {
      size -= 14;
    }
    if (player.getInterfaceAttribute("fightPitOrbs") != null) {
      return;
    }
    if (packet.getOpcode() != 59) { // force walking
      player.getCombatState().setQueuedSpell(null);
      player.resetInteractingEntity();
      player.getActionQueue().clearAllActions();
      player.getActionSender().removeAllInterfaces();
    }

    player.getWalkingQueue().reset();

    if (!player.getCombatState().canMove()) {
      if (packet.getOpcode() != 59) { // force walking
        player.getActionSender().sendMessage("A magical force stops you from moving.");
      }
      return;
    }
    if (!player.canEmote()) {
      return; // stops walking during skillcape animations.
    }

    final int steps = (size - 5) / 2;
    final int[][] path = new int[steps][2];

    for (int i = 0; i < steps; i++) {
      final int byte1 = packet.getByte();
      final int byteS = packet.getByteS();
      path[i][0] = byte1;
      path[i][1] = byteS;
    }
    final int firstX = packet.getShortA();
    final int firstY = packet.getLEShort();
    final boolean runSteps = packet.get() == 1;

    player.getWalkingQueue().setRunningQueue(runSteps);
    player.getWalkingQueue().addStep(firstX, firstY);
    for (int i = 0; i < steps; i++) {
      path[i][0] += firstX;
      path[i][1] += firstY;
      player.getWalkingQueue().addStep(path[i][0], path[i][1]);
    }
    player.getWalkingQueue().finish();
    // Boothes.outBooth(player);
  }