Ejemplo n.º 1
0
  public void setupSkillCapes(int capes, int capes2) {
    synchronized (c) {
      c.getItems().resetItems(3823);
      c.isShopping = true;
      c.myShopId = 14;
      c.getPA().sendFrame248(3824, 3822);
      c.getPA().sendFrame126("reflexion SkillCape Shop", 3901);

      int TotalItems = 0;
      TotalItems = capes2;
      if (TotalItems > Server.shopHandler.MaxShopItems) {
        TotalItems = Server.shopHandler.MaxShopItems;
      }
      c.getOutStream().createFrameVarSizeWord(53);
      c.getOutStream().writeWord(3900);
      c.getOutStream().writeWord(TotalItems);
      int TotalCount = 0;
      for (int i = 0; i < 23; i++) {
        if (c.getLevelForXP(c.playerXP[i]) < 99) continue;
        c.getOutStream().writeByte(1);
        c.getOutStream().writeWordBigEndianA(skillCapes[i] + 2);
        TotalCount++;
      }
      c.getOutStream().endFrameVarSizeWord();
      c.flushOutStream();
    }
  }
Ejemplo n.º 2
0
 /** Shops */
 public void openShop(int ShopID) {
   c.getItems().resetItems(3823);
   resetShop(ShopID);
   c.isShopping = true;
   c.myShopId = ShopID;
   c.getPA().sendFrame248(3824, 3822);
   c.getPA().sendFrame126(Server.shopHandler.ShopName[ShopID], 3901);
 }
Ejemplo n.º 3
0
 public void openPlayerShop(Client o) {
   if (o == null || o.properLogout) return;
   c.getItems().resetItems(3823);
   resetShop(o);
   c.myShopClient = o;
   c.myShopId = 7390;
   c.isShopping = true;
   c.getPA().sendFrame248(3824, 3822);
   c.getPA().sendFrame126(Misc.optimizeText(o.playerName) + "'s personal shop!", 3901);
 }
Ejemplo n.º 4
0
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    if (packetType == 248 || packetType == 164) {
      c.faceUpdate(0);
      if (c.SSPLIT == false) {
        c.npcIndex = 0;
        c.playerIndex = 0;
      } else {
      }
      if (c.followId > 0 || c.followId2 > 0) c.getPA().resetFollow();
    }
    c.fishing = false;
    if (!c.isBanking && !c.inTrade) {
      c.getPA().removeAllWindows();
    }
    if (c.duelRule[1] && c.duelStatus == 5) {
      if (Server.playerHandler.players[c.duelingWith] != null) {
        if (!c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.duelingWith].getX(),
                Server.playerHandler.players[c.duelingWith].getY(),
                1)
            || c.attackTimer == 0) {
          c.sendMessage("Walking has been disabled in this duel!");
        }
      }
      c.playerIndex = 0;
      return;
    }

    if (c.freezeTimer > 0) {
      if (Server.playerHandler.players[c.playerIndex] != null) {
        if (c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.playerIndex].getX(),
                Server.playerHandler.players[c.playerIndex].getY(),
                1)
            && packetType != 98) {
          c.playerIndex = 0;
          return;
        }
      }
      if (packetType != 98) {
        c.sendMessage("A magical force stops you from moving.");
        c.playerIndex = 0;
      }
      return;
    }

    if (System.currentTimeMillis() - c.lastSpear < 4000) {
      c.sendMessage("You have been stunned.");
      c.playerIndex = 0;
      return;
    }

    if (packetType == 98) {
      c.mageAllowed = true;
      c.fishing = false;
    }

    if (c.sit == true) {
      c.sendMessage("::unsit before you can start walking again!");
      return;
    }

    if ((c.duelStatus >= 1 && c.duelStatus <= 4) || c.duelStatus == 6) {
      if (c.duelStatus == 6) {
        c.getTradeAndDuel().claimStakedItems();
      }
      return;
    }

    if (c.respawnTimer > 3) {
      return;
    }
    if (System.currentTimeMillis() - c.lastEmote <= 7000) {
      return;
    }
    if (c.inTrade) {
      c.sendMessage("Please use the Decline option.");
      return;
    }
    if (c.isBanking) {
      c.getPA().closeAllWindows();
    }
    if (c.isShopping == true) {
      c.isShopping = false;
    }
    if (packetType == 248) {
      packetSize -= 14;
    }
    c.newWalkCmdSteps = (packetSize - 5) / 2;
    if (++c.newWalkCmdSteps > c.walkingQueueSize) {
      c.newWalkCmdSteps = 0;
      return;
    }

    c.getNewWalkCmdX()[0] = c.getNewWalkCmdY()[0] = 0;

    int firstStepX = c.getInStream().readSignedWordBigEndianA() - c.getMapRegionX() * 8;
    for (int i = 1; i < c.newWalkCmdSteps; i++) {
      c.getNewWalkCmdX()[i] = c.getInStream().readSignedByte();
      c.getNewWalkCmdY()[i] = c.getInStream().readSignedByte();
    }

    int firstStepY = c.getInStream().readSignedWordBigEndian() - c.getMapRegionY() * 8;
    c.setNewWalkCmdIsRunning(c.getInStream().readSignedByteC() == 1);
    for (int i1 = 0; i1 < c.newWalkCmdSteps; i1++) {
      c.getNewWalkCmdX()[i1] += firstStepX;
      c.getNewWalkCmdY()[i1] += firstStepY;
    }
  }