Ejemplo n.º 1
0
 /**
  * Sends a config toggle.
  *
  * @param id The config id.
  * @param state On or off.
  * @return The action sender instance, for chaining.
  */
 public ActionSender sendConfig(int id, int state) {
   player.getOutStream().createFrame(36);
   player.getOutStream().writeWordBigEndian(id);
   player.getOutStream().writeByte(state);
   player.flushOutStream();
   return this;
 }
Ejemplo n.º 2
0
 @Override
 public void processPacket(Player player, int packetType, int packetSize) {
   int somejunk = player.getInStream().readUnsignedWordA(); // junk
   int itemFrom = player.getInStream().readUnsignedWordA(); // slot1
   int itemTo = (player.getInStream().readUnsignedWordA() - 128); // slot2
   // c.sendMessage("junk: " + somejunk);
   player.getItems().moveItems(itemFrom, itemTo, somejunk);
 }
Ejemplo n.º 3
0
 /**
  * Sends a string.
  *
  * @param id The interface id.
  * @param string The string.
  * @return The action sender instance, for chaining.
  */
 public ActionSender sendString(int id, String string) {
   player.getOutStream().createFrameVarSizeWord(126);
   player.getOutStream().writeString(string);
   player.getOutStream().writeWordA(id);
   player.getOutStream().endFrameVarSizeWord();
   player.flushOutStream();
   return this;
 }
Ejemplo n.º 4
0
 /**
  * Opens Point Exchange
  *
  * @param player
  * @param button
  */
 public static void exchangePestPoints(Player player) {
   if (!CAN_EXCHANGE_POINTS) {
     player.getActionSender().sendMessage("Pest Control point exchange is currently disabled.");
     return;
   }
   player.getPA().sendFrame126("Void Knights' Training Options", 18758);
   player.getPA().sendFrame126("ATTACK", 18767);
   player.getPA().sendFrame126("STRENGTH", 18768);
   player.getPA().sendFrame126("DEFENCE", 18769);
   player.getPA().sendFrame126("RANGED", 18770);
   player.getPA().sendFrame126("MAGIC", 18771);
   player.getPA().sendFrame126("HITPOINTS", 18772);
   player.getPA().sendFrame126("PRAYER", 18773);
   player.getPA().sendFrame126(checkReward(), 18782);
   player.getPA().sendFrame126("Points: " + player.pcPoints, 18783);
   player
       .getActionSender()
       .sendMessage("You currently have " + player.pcPoints + " pest control points.");
   player.getPA().showInterface(REWARDS_INTERFACE);
 }
Ejemplo n.º 5
0
  @Override
  public void processPacket(Player player, int packetType, int packetSize) {
    /*
     * a = ?
     * b = ?
     */

    @SuppressWarnings("unused")
    int a = player.getInStream().readUnsignedWord();
    int objectId = player.getInStream().readSignedWordBigEndian();
    int objectY = player.getInStream().readSignedWordBigEndianA();
    @SuppressWarnings("unused")
    int b = player.getInStream().readUnsignedWord();
    int objectX = player.getInStream().readSignedWordBigEndianA();
    int itemId = player.getInStream().readUnsignedWord();
    UseItem.ItemonObject(player, objectId, objectX, objectY, itemId);
  }
Ejemplo n.º 6
0
  public static void handlePestButtons(Player player, int button) {
    switch (button) {

        /** Attack */
      case 73072:
      case 73079:
        rewardSelected = ATTACK;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Strength */
      case 73073:
      case 73080:
        rewardSelected = STRENGTH;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Defence */
      case 73074:
      case 73081:
        rewardSelected = DEFENCE;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Ranged */
      case 73075:
      case 73082:
        rewardSelected = RANGED;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Magic */
      case 73076:
      case 73083:
        rewardSelected = MAGIC;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Hitpoints */
      case 73077:
      case 73084:
        rewardSelected = HITPOINTS;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Prayer */
      case 73078:
      case 73085:
        rewardSelected = PRAYER;
        player.getPA().sendFrame126(checkReward(), 18782);
        break;

        /** Confirm */
      case 73091:
        switch (rewardSelected) {
          case NONE:
            player.getActionSender().sendMessage("You don't have a reward selected.");
            break;

          case ATTACK:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.ATTACK.getSkillId()]
                          * player.playerLevel[SkillIndex.ATTACK.getSkillId()]
                          / 17.5
                          * 4,
                      SkillIndex.ATTACK.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded attack experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
          case STRENGTH:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.STRENGTH.getSkillId()]
                          * player.playerLevel[SkillIndex.STRENGTH.getSkillId()]
                          / 17.5
                          * 4,
                      SkillIndex.STRENGTH.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded strength experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
          case DEFENCE:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.DEFENCE.getSkillId()]
                          * player.playerLevel[SkillIndex.DEFENCE.getSkillId()]
                          / 17.5
                          * 4,
                      SkillIndex.DEFENCE.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded defence experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
          case RANGED:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.RANGE.getSkillId()]
                          * player.playerLevel[SkillIndex.RANGE.getSkillId()]
                          / 17.5
                          * 4,
                      SkillIndex.RANGE.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded ranged experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
          case MAGIC:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.MAGIC.getSkillId()]
                          * player.playerLevel[SkillIndex.MAGIC.getSkillId()]
                          / 17.5
                          * 4,
                      SkillIndex.MAGIC.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded magic experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
          case HITPOINTS:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.HITPOINTS.getSkillId()]
                          * player.playerLevel[SkillIndex.HITPOINTS.getSkillId()]
                          / 17.5
                          * 4,
                      SkillIndex.HITPOINTS.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded hitpoints experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
          case PRAYER:
            if (player.pcPoints > 1) {
              player
                  .getPA()
                  .addSkillXP(
                      player.playerLevel[SkillIndex.PRAYER.getSkillId()]
                          * player.playerLevel[SkillIndex.PRAYER.getSkillId()]
                          / 8.75
                          * 4,
                      SkillIndex.PRAYER.getSkillId());
              player.getActionSender().sendMessage("You have been rewarded prayer experience.");
              player.pcPoints -= 2;
            } else {
              player
                  .getActionSender()
                  .sendMessage("You need at least 2 pest control points to exchange your points.");
            }
            break;
        }

        player.getPA().sendFrame126("Points: " + player.pcPoints, 18783);
        break;
    }
  }
Ejemplo n.º 7
0
 public void playerIsMember(int i1) {
   player.outStream.createFrame(249);
   player.outStream.writeByteA(i1);
   player.outStream.writeWordBigEndianA(player.getId());
 }