Package net.bnubot.util

Examples of net.bnubot.util.BNetInputStream.readWord()


             * (WORD)     Flags
             * (STRING)    Character statstring
             */
            is.readWord();
            is.readDWord();
            int numChars = is.readWord();

            List<MCPCharacter> chars = new ArrayList<MCPCharacter>(numChars);

            for(int i = 0; i < numChars; i++) {
              final long time = (1000L * is.readDWord()) - System.currentTimeMillis();
View Full Code Here


    int vbProduct = vbInputStream.readDWord();
    if (vbProduct == 0)
      throw new IOException("BNLS_REQUESTVERSIONBYTE failed.");
    if(vbProduct != product.getBnls())
      throw new IOException("BNLS_REQUESTVERSIONBYTE returned the wrong product [0x" + Integer.toHexString(vbProduct) + "]");
    return vbInputStream.readWord();
  }

  public VersionCheckResult sendVersionCheckEx2(Task task, ProductIDs productID, long MPQFileTime, String MPQFileName, byte[] ValueStr) throws IOException, InterruptedException {
    try (BNLSPacket bnlsOut = new BNLSPacket(BNLSPacketId.BNLS_VERSIONCHECKEX2)) {
      bnlsOut.writeDWord(productID.getBnls());
View Full Code Here

  private static BNetIcon[] readIconsDotBni(File f) {
    try (BNetInputStream is = new BNetInputStream(new FileInputStream(f))) {
      Out.debug(IconsDotBniReader.class, "Reading " + f.getName());

      is.skip(4); //int headerSize = is.readDWord();
      int bniVersion = is.readWord();
      is.skip(2)// Alignment Padding (unused)
      int numIcons = is.readDWord();
      is.skip(4)//int dataOffset = is.readDWord();

      if(bniVersion != 1)
View Full Code Here

        case PACKET_COMMAND: {
          // PROTOCOL VIOLATION!
          int err = is.readDWord();
          byte id = is.readByte();
          int lenOffending = is.readWord();
          int lenUnprocessed = is.readWord();
          dispatchRecieveError("Protocol violation: err=" + err + ", packet=" + BotNetPacketId.values()[id].name() + ", offending packet len=" + lenOffending + ", unprocessed data len=" + lenUnprocessed);
          disconnect(ConnectionState.LONG_PAUSE_BEFORE_CONNECT);
          break;
        }
View Full Code Here

        case PACKET_COMMAND: {
          // PROTOCOL VIOLATION!
          int err = is.readDWord();
          byte id = is.readByte();
          int lenOffending = is.readWord();
          int lenUnprocessed = is.readWord();
          dispatchRecieveError("Protocol violation: err=" + err + ", packet=" + BotNetPacketId.values()[id].name() + ", offending packet len=" + lenOffending + ", unprocessed data len=" + lenUnprocessed);
          disconnect(ConnectionState.LONG_PAUSE_BEFORE_CONNECT);
          break;
        }
        default:
View Full Code Here

      is.skip(1);              // ColorMapType
      byte imageType = is.readByte();    // run-length true-color image types = 0x0A
      is.skip(5);              // ColorMapSpecification - color map data
      is.skip(2)//int xOrigin = is.readWord();
      is.skip(2)//int yOrigin = is.readWord();
      int width = is.readWord();
      int height = is.readWord();
      byte depth = is.readByte();      // 24 bit depth is good
      /*byte descriptor =*/ is.readByte()// bits 5 and 4 (00110000) specify the corner to start coloring pixels - 00=bl, 01=br, 10=tl, 11=tr
      is.skip(infoLength)//String info = is.readFixedLengthString(infoLength);

View Full Code Here

      byte imageType = is.readByte();    // run-length true-color image types = 0x0A
      is.skip(5);              // ColorMapSpecification - color map data
      is.skip(2)//int xOrigin = is.readWord();
      is.skip(2)//int yOrigin = is.readWord();
      int width = is.readWord();
      int height = is.readWord();
      byte depth = is.readByte();      // 24 bit depth is good
      /*byte descriptor =*/ is.readByte()// bits 5 and 4 (00110000) specify the corner to start coloring pixels - 00=bl, 01=br, 10=tl, 11=tr
      is.skip(infoLength)//String info = is.readFixedLengthString(infoLength);

      if(imageType != 0x0A)
View Full Code Here

        seed);

    byte u = is.readByte();
    int cookie = is.readDWord();
    byte result = is.readByte();
    short dataLen = is.readWord();
    if(u != 0)
      throw new IOException("wrong useage");
    if(cookie != cookie_out)
      throw new IOException("wrong cookie");
    if(result != 0)
View Full Code Here

    BNetInputStream is = bnls.sendWarden1(cookie_out, payload);

    byte u = is.readByte();
    int cookie = is.readDWord();
    byte result = is.readByte();
    short dataLen = is.readWord();
    byte[] data = new byte[dataLen];
    is.read(data);

    if(u != 1)
      throw new IOException("wrong useage");
View Full Code Here

  public BNLSPacketReader(InputStream rawis) throws IOException {
    // Operates on a socket, which we don't want to close; suppress the warning
    @SuppressWarnings("resource")
    BNetInputStream is = new BNetInputStream(rawis);

    packetLength = is.readWord() & 0x0000FFFF;
    packetId = BNLSPacketId.values()[is.readByte() & 0x000000FF];
    assert(packetLength >= 3);

    data = new byte[packetLength-3];
    for(int i = 0; i < packetLength-3; i++)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.