Пример #1
0
 public void testForwardString() {
   qedeqInput.forward("zafsduizasif");
   assertEquals(832, qedeqInput.getPosition());
   qedeqInput.setPosition(0);
   qedeqInput.forward("<?xml");
   assertEquals(0, qedeqInput.getPosition());
 }
Пример #2
0
  public RegisterManager() {
    super(USE_ALL_WIDTH | VERTICAL_SCROLL | VERTICAL_SCROLLBAR);

    XYEdges boxEdges = new XYEdges(0, 20, 5, 20);
    XYEdges buttonEdges = new XYEdges(0, 20, 0, 20);

    userInput = new UserInput();
    userInput.setDefaultText("E-mail as username");
    userInput.setPadding(boxEdges);
    add(userInput);

    firstnameEdit = new TextInput("First name");
    firstnameEdit.setPadding(boxEdges);
    add(firstnameEdit);

    lastnameEdit = new TextInput("Last name");
    lastnameEdit.setPadding(boxEdges);
    add(lastnameEdit);

    passInput = new PassLockInput();
    passInput.setPadding(boxEdges);
    add(passInput);

    confirmPassInput = new PassInput();
    confirmPassInput.setPadding(boxEdges);
    add(confirmPassInput);

    GreenLabelField greenButton = new GreenLabelField("Submit");
    greenButton.setMargin(buttonEdges);
    greenButton.setChangeListener(this);
    add(greenButton);
  }
Пример #3
0
  /** Test constructor {@link TextInput#TextInput(Reader)}. */
  public void testTextInputReader() throws Exception {
    final TextInput ti =
        new TextInput(
            new Reader() {
              int pos = 0;

              public void close() throws IOException {}

              public int read(char[] cbuf, int off, int len) throws IOException {
                if (pos >= XML_DATA.length()) {
                  return -1;
                }
                final String result = StringUtility.substring(XML_DATA, pos, len);
                for (int i = 0; i < result.length(); i++) {
                  cbuf[off + i] = result.charAt(i);
                }
                pos += result.length();
                return result.length();
              }
            });
    int i = 0;
    while (!ti.isEmpty()) {
      assertEquals(ti.read(), XML_DATA.charAt(i++));
    }
    try {
      new TextInput((Reader) null);
      fail("NullPointerException expected");
    } catch (NullPointerException e) {
      // expected
    }
  }
Пример #4
0
  /**
   * Searches a string in a file.
   *
   * @param path file path
   * @param search codepoints of search string
   * @return success flag
   */
  private static boolean filterContent(final String path, final int[] search) {
    final int cl = search.length;
    if (cl == 0) return true;

    try (final TextInput ti = new TextInput(new IOFile(path))) {
      final IntList il = new IntList(cl - 1);
      int c = 0;
      while (true) {
        if (!il.isEmpty()) {
          if (il.remove(0) == search[c++]) continue;
          c = 0;
        }
        while (true) {
          final int cp = ti.read();
          if (cp == -1 || !XMLToken.valid(cp)) return false;
          final int lc = Token.lc(cp);
          if (c > 0) il.add(lc);
          if (lc == search[c]) {
            if (++c == cl) return true;
          } else {
            c = 0;
            break;
          }
        }
      }
    } catch (final IOException ex) {
      // file may not be accessible
      Util.debug(ex);
      return false;
    }
  }
Пример #5
0
 @Override
 int read(final TextInput ti) throws IOException {
   final int a = ti.readByte();
   if (a < 0) return a;
   final int b = ti.readByte();
   if (b < 0) return invalid();
   return a << 8 | b;
 }
Пример #6
0
 /** Tests {@link TextInput#readCounter()}. */
 public void testReadCounter() {
   qedeqInput.setRow(18);
   assertEquals("1789", qedeqInput.readCounter());
   try {
     qedeqInput.readCounter();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
   qedeqInput.read();
   try {
     qedeqInput.readCounter();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
   qedeqInput.read();
   assertEquals("1239", qedeqInput.readCounter());
   try {
     qedeqInput.readCounter();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
   try {
     emptyInput.readCounter();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
 }
Пример #7
0
 /** Test constructor {@link TextInput#TextInput(String)}. */
 public void testTextInputStringStringString() {
   int i = 0;
   while (!qedeqInput.isEmpty()) {
     assertEquals(qedeqInput.read(), XML_DATA.charAt(i++));
   }
   try {
     new TextInput((String) null);
     fail("NullPointerException expected");
   } catch (NullPointerException e) {
     // expected
   }
 }
Пример #8
0
 @Override
 int read(final TextInput ti) throws IOException {
   final int a = ti.readByte();
   if (a < 0) return a;
   final int b = ti.readByte();
   if (b < 0) return invalid();
   final int c = ti.readByte();
   if (c < 0) return invalid();
   final int d = ti.readByte();
   if (d < 0) return invalid();
   return a << 24 | b << 16 | c << 8 | d;
 }
Пример #9
0
 protected void onScriptError(ScriptException e) {
   setStatus("script error in " + getLabel());
   System.err.print(e);
   ArrayList<String> lines = new ArrayList<String>();
   lines.add("Script Error: " + getLabel());
   lines.add("line: " + e.getLineNumber());
   lines.add("column: " + e.getColumnNumber());
   lines.add("text: " + e.toString());
   lines.add("message: " + e.getMessage());
   scriptError.setText(lines);
   scriptError.setParent(this);
   scriptError.setActive(true);
 }
Пример #10
0
 /** Test constructor {@link TextInput#TextInput(StringBuffer)}. */
 public void testTextInputStringBufferStringString() {
   final StringBuffer buffer = new StringBuffer(XML_DATA);
   final TextInput ti = new TextInput(buffer);
   int i = 0;
   while (!ti.isEmpty()) {
     assertEquals(ti.read(), XML_DATA.charAt(i++));
   }
   try {
     new TextInput((StringBuffer) null);
     fail("NullPointerException expected");
   } catch (NullPointerException e) {
     // expected
   }
 }
Пример #11
0
 @Override
 int read(final TextInput ti) throws IOException {
   int ch = ti.readByte();
   if (ch < 0x80) return ch;
   if (ch < 0xC0) return invalid();
   cache[0] = (byte) ch;
   final int cl = Token.cl((byte) ch);
   for (int c = 1; c < cl; ++c) {
     ch = ti.readByte();
     if (ch < 0x80) return invalid();
     cache[c] = (byte) ch;
   }
   return Token.cp(cache, 0);
 }
Пример #12
0
 /**
  * Test constructor {@link TextInput#TextInput(File)}.
  *
  * @throws Exception Test failed.
  */
 public void testTextInputFileString() throws Exception {
   final File file = new File(getOutdir(), this.getClass().getName() + ".testTexFileInput.impl");
   IoUtility.saveFile(file, XML_DATA, IoUtility.getDefaultEncoding());
   TextInput ti = new TextInput(file, IoUtility.getDefaultEncoding());
   while (!qedeqInput.isEmpty()) {
     assertEquals(qedeqInput.read(), ti.read());
   }
   try {
     new TextInput((File) null, "UTF-8");
     fail("Exception expected");
   } catch (RuntimeException e) {
     // OK
   }
   assertTrue(file.delete());
 }
Пример #13
0
 public void testReadXmlName() {
   final TextInput ti = new TextInput("<Head this=\">is not the end\">zulu");
   try {
     ti.readNextXmlName();
     fail("Exception expected"); // we are not within the tag yet
   } catch (RuntimeException e) {
     // OK
   }
   ti.read();
   assertEquals("Head", ti.readNextXmlName());
   assertEquals("this", ti.readNextXmlName());
   try {
     System.out.println("name=" + ti.readNextXmlName());
     fail("Exception expected"); // now we have the value
   } catch (RuntimeException e) {
     // OK
   }
   assertEquals(">is not the end", ti.readNextAttributeValue());
   try {
     System.out.println("name=" + ti.readNextXmlName());
     fail("Exception expected"); // now we have the value
   } catch (RuntimeException e) {
     // OK
   }
 }
Пример #14
0
  public void fieldChanged(Field field, int context) {
    if (field instanceof GreenLabelField) {
      String pass = passInput.getValue();
      String confirm = confirmPassInput.getValue();
      String username = userInput.getValue().trim();
      if (validateUsername(username) && validatePassword(pass, confirm)) {
        URLEncodedPostData postData = new URLEncodedPostData(null, false);
        String name = firstnameEdit.getValue().trim() + " " + lastnameEdit.getValue().trim();
        postData.append("name", name);
        postData.append("email", username);
        postData.append("password", pass);

        RegisterConnector registerConnector = new RegisterConnector(postData);
        registerConnector.start();
        UiApplication.getUiApplication().pushScreen(new LoadingScreen(registerConnector));
      }
    }
  }
Пример #15
0
 @Override
 protected void onNonUnicodeInput() {
   super.onNonUnicodeInput();
   if (nonUnicodesPressed.contains(KeyEvent.VK_F5)) {
     compile();
   }
   if (nonUnicodesPressed.contains(KeyEvent.VK_F6)) {
     execute();
   }
 }
Пример #16
0
  /**
   * Refreshes the view after a file has been saved.
   *
   * @param root root directory
   * @param ctx database context
   * @throws InterruptedException interruption
   */
  void parse(final IOFile root, final Context ctx) throws InterruptedException {
    final long id = ++parseId;
    final HashSet<String> parsed = new HashSet<>();
    final TreeMap<String, InputInfo> errs = new TreeMap<>();

    // collect files to be parsed
    final ProjectCache pc = cache(root);
    final StringList mods = new StringList(), lmods = new StringList();
    for (final String path : pc) {
      final IOFile file = new IOFile(path);
      if (file.hasSuffix(IO.XQSUFFIXES)) (file.hasSuffix(IO.XQMSUFFIX) ? lmods : mods).add(path);
    }
    mods.add(lmods);

    // parse modules
    for (final String path : mods) {
      if (id != parseId) throw new InterruptedException();
      if (parsed.contains(path)) continue;

      final IOFile file = new IOFile(path);
      try (final TextInput ti = new TextInput(file)) {
        // parse query
        try (final QueryContext qc = new QueryContext(ctx)) {
          final String input = ti.cache().toString();
          final boolean lib = QueryProcessor.isLibrary(input);
          qc.parse(input, lib, path, null);
          // parsing was successful: remember path
          parsed.add(path);
          for (final byte[] mod : qc.modParsed) parsed.add(Token.string(mod));
        } catch (final QueryException ex) {
          // parsing failed: remember path
          final InputInfo ii = ex.info();
          errs.put(path, ii);
          parsed.add(ii.path());
        }
      } catch (final IOException ex) {
        // file may not be accessible
        Util.debug(ex);
      }
    }
    errors = errs;
  }
Пример #17
0
 /** Test {@link TextInput#getChar()}. */
 public void testGetChar() {
   final String first = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
   for (int i = 0; i < first.length(); i++) {
     assertEquals(first.charAt(i), qedeqInput.getChar());
     assertEquals(first.charAt(i), qedeqInput.read());
   }
   qedeqInput.setPosition(qedeqInput.getMaximumPosition());
   for (int i = 0; i < 10; i++) {
     assertEquals(-1, qedeqInput.getChar());
     assertEquals(-1, qedeqInput.read());
   }
   qedeqInput.setPosition(0);
   for (int i = 0; i < first.length(); i++) {
     assertEquals(first.charAt(i), qedeqInput.getChar());
     assertEquals(first.charAt(i), qedeqInput.read());
   }
 }
Пример #18
0
 public void testReplace() {
   final String text = "one two three";
   final TextInput ti = new TextInput(text);
   ti.replace(4, 7, "2");
   assertEquals("one 2 three", ti.asString());
   ti.skipToEndOfLine();
   ti.replace(0, 3, "1");
   ti.setPosition(2);
   ti.replace(0, 2, "");
 }
Пример #19
0
 /** Test {@link TextInput#equals(Object)}. */
 public void testEquals() {
   assertTrue(qedeqInput.equals(qedeqInput));
   assertFalse(emptyInput.equals(qedeqInput));
   assertFalse(emptyInput.equals(null));
   assertFalse(qedeqInput.equals(null));
   assertFalse(qedeqInput.equals(emptyInput));
   assertTrue(emptyInput.equals(emptyInput));
 }
Пример #20
0
 /** Test {@link TextInput#readLetterDigitString()}. */
 public void testReadLetterDigitString() {
   qedeqInput.read();
   qedeqInput.read();
   assertEquals("xml", qedeqInput.readLetterDigitString());
   qedeqInput.setRow(13);
   assertEquals("Example1", qedeqInput.readLetterDigitString());
   qedeqInput.setRow(13);
   qedeqInput.setColumn(1);
   qedeqInput.skipWhiteSpace();
   assertEquals("Example1", qedeqInput.readLetterDigitString());
   try {
     qedeqInput.readLetterDigitString();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
   try {
     emptyInput.readLetterDigitString();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
 }
Пример #21
0
  public PresentationObject getPresentationObject(IWContext iwc) {
    if (this._addTextInput) {
      TextInput input = new TextInput(this.displayInputName + "_chooser");
      input.setDisabled(this.disabled);
      input.setId(input.getName());

      if (this._buttonImage != null) {
        this._buttonImage.setMarkupAttribute(
            ICBuilderConstants.CHOOSER_VALUE_VIEWER_ID_ATTRIBUTE, input.getId());
      }

      if (this._inputLength > 0) {
        input.setLength(this._inputLength);
      }

      if (this._style != null) {
        input.setMarkupAttribute("style", this._style);
      }
      if (this.isStyleClassSet) {
        input.setStyleClass(this.styleClassName);
      }

      if (this._stringDisplay != null) {
        input.setValue(this._stringDisplay);
      }

      input.setStyleClass(CoreConstants.BUILDER_PORPERTY_SETTER_STYLE_CLASS);
      return input;
    } else {
      HiddenInput input = new HiddenInput(this.displayInputName);
      if (this._stringDisplay != null) {
        input.setValue(this._stringDisplay);
      }
      return input;
    }
  }
Пример #22
0
 /** Test {@link TextInput#isEmpty()}. */
 public void testIsEmpty() {
   assertFalse(qedeqInput.isEmpty());
   final String first = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
   for (int i = 0; i < first.length(); i++) {
     qedeqInput.read();
     assertFalse(qedeqInput.isEmpty());
   }
   qedeqInput.setPosition(qedeqInput.getMaximumPosition());
   assertTrue(qedeqInput.isEmpty());
 }
Пример #23
0
 @Override
 int read(final TextInput ti) throws IOException {
   int c = -1;
   while (++c < 4) {
     final int ch = ti.readByte();
     if (ch < 0) break;
     cache[c] = (byte) ch;
     outc.position(0);
     inc.position(0);
     inc.limit(c + 1);
     csd.reset();
     final CoderResult cr = csd.decode(inc, outc, true);
     if (cr.isMalformed()) continue;
     // return character
     int i = 0;
     final int os = outc.position();
     for (int o = 0; o < os; ++o) i |= outc.get(o) << (o << 3);
     return i;
   }
   return c == 0 ? -1 : invalid();
 }
Пример #24
0
  /**
   * Performs a test on the specified data.
   *
   * @param data data to be tested
   * @throws IOException I/O exception
   */
  private static void run(final byte[] data) throws IOException {
    final TokenBuilder tb = new TokenBuilder();
    final TextInput ti = new TextInput(new IOContent(data));
    ti.read();
    ti.reset();

    for (int b; (b = ti.read()) != -1; ) tb.add(b);
    try {
      ti.reset();
      assertTrue(
          "Mark should not be supported for data size of " + data.length,
          data.length < IO.BLOCKSIZE);
      tb.reset();
      for (int b; (b = ti.read()) != -1; ) tb.add(b);
      assertSame(data, tb.finish());
    } catch (final IOException ex) {
      assertTrue(
          "Mark could not be reset for data size of " + data.length, data.length >= IO.BLOCKSIZE);
    }
  }
Пример #25
0
 protected void compileAndClose() {
   if (compile()) {
     super.saveAndClose();
     updateCompilationListeners();
   }
 }
Пример #26
0
  /**
   * Converts an HTML document to XML.
   *
   * @param io io reference
   * @param opts html options
   * @return parser
   * @throws IOException I/O exception
   */
  private static IO toXML(final IO io, final HtmlOptions opts) throws IOException {
    // reader could not be initialized; fall back to XML
    if (READER == null) return io;

    try {
      // tries to extract the encoding from the input
      final TextInput ti = new TextInput(io);
      String enc = ti.encoding();
      final byte[] content = ti.content();

      // looks for a charset definition
      final byte[] encoding = token("charset=");
      int cs = indexOf(content, encoding);
      if (cs > 0) {
        // extracts the encoding string
        cs += encoding.length;
        int ce = cs;
        final int cl = content.length;
        while (++ce < cl && content[ce] > 0x28) ;
        enc = string(substring(content, cs, ce));
      }

      // define input
      final InputSource is = new InputSource(new ArrayInput(content));
      is.setEncoding(supported(enc) ? normEncoding(enc) : UTF8);
      // define output
      final StringWriter sw = new StringWriter();
      final XMLReader reader = (XMLReader) Reflect.get(READER);
      final Object writer = Reflect.get(WRITER, sw);

      // set TagSoup options
      if (opts.get(HtmlOptions.HTML)) {
        reader.setFeature("http://xml.org/sax/features/namespaces", false);
        opt("method", "html");
        opt("omit-xml-declaration", "yes");
      }
      if (opts.get(HtmlOptions.NONS))
        reader.setFeature("http://xml.org/sax/features/namespaces", false);
      if (opts.get(HtmlOptions.OMITXML)) opt("omit-xml-declaration", "yes");
      if (opts.get(HtmlOptions.NOBOGONS)) reader.setFeature(FEATURES + "ignore-bogons", true);
      if (opts.get(HtmlOptions.NODEFAULTS))
        reader.setFeature(FEATURES + "default-attributes", false);
      if (opts.get(HtmlOptions.NOCOLONS)) reader.setFeature(FEATURES + "translate-colons", true);
      if (opts.get(HtmlOptions.NORESTART)) reader.setFeature(FEATURES + "restart-elements", false);
      if (opts.get(HtmlOptions.IGNORABLE))
        reader.setFeature(FEATURES + "ignorable-whitespace", true);
      if (opts.get(HtmlOptions.EMPTYBOGONS)) reader.setFeature(FEATURES + "bogons-empty", true);
      if (opts.get(HtmlOptions.ANY)) reader.setFeature(FEATURES + "bogons-empty", false);
      if (opts.get(HtmlOptions.NOROOTBOGONS)) reader.setFeature(FEATURES + "root-bogons", false);
      if (opts.get(HtmlOptions.NOCDATA)) reader.setFeature(FEATURES + "cdata-elements", false);
      if (opts.get(HtmlOptions.LEXICAL))
        reader.setProperty("http://xml.org/sax/properties/lexical-handler", writer);
      if (opts.contains(HtmlOptions.METHOD)) opt("method", opts.get(HtmlOptions.METHOD));
      if (opts.contains(HtmlOptions.DOCTYPESYS))
        opt("doctype-system", opts.get(HtmlOptions.DOCTYPESYS));
      if (opts.contains(HtmlOptions.DOCTYPEPUB))
        opt("doctype-public", opts.get(HtmlOptions.DOCTYPEPUB));
      if (opts.contains(HtmlOptions.ENCODING)) is.setEncoding(opts.get(HtmlOptions.ENCODING));
      // end TagSoup options

      reader.setContentHandler((ContentHandler) writer);
      reader.parse(is);
      return new IOContent(token(sw.toString()), io.name());

    } catch (final SAXException ex) {
      Util.errln(ex);
      return io;
    }
  }
Пример #27
0
 /** Test {@link TextInput#readQuoted()}. */
 public void testReadQuoted() {
   final TextInput first = new TextInput("Hell=\"one\" Water=\"two\"");
   first.setPosition(5);
   assertEquals("one", first.readQuoted());
   first.readString(7);
   assertEquals("two", first.readQuoted());
   final TextInput second = new TextInput("\"\"\"one\" Water=\"two\"");
   assertEquals("\"one", second.readQuoted());
   second.setPosition(1);
   assertEquals("", second.readQuoted());
   final int position = second.getPosition();
   try {
     second.readQuoted();
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
   assertTrue(position < second.getPosition());
 }
Пример #28
0
 /** Test {@link TextInput#readInverse()}. */
 public void testReadInverse() {
   assertEquals(-1, qedeqInput.readInverse());
   assertEquals('<', qedeqInput.read());
   assertEquals('<', qedeqInput.readInverse());
 }
Пример #29
0
  private boolean parsePacket() {
    if (socketStream == null) return false;
    try {
      int i = socketStream.available();
      if (i == 0) return false;
      if (pktType == -1) {
        socketStream.flushInputStream(inStream.buffer, 1);
        pktType = inStream.buffer[0] & 0xff;
        if (encryption != null) pktType = pktType - encryption.getNextKey() & 0xff;
        pktSize = SizeConstants.packetSizes[pktType];
        i--;
      }
      if (pktSize == -1)
        if (i > 0) {
          socketStream.flushInputStream(inStream.buffer, 1);
          pktSize = inStream.buffer[0] & 0xff;
          i--;
        } else {
          return false;
        }
      if (pktSize == -2)
        if (i > 1) {
          socketStream.flushInputStream(inStream.buffer, 2);
          inStream.currentOffset = 0;
          pktSize = inStream.readUnsignedWord();
          i -= 2;
        } else {
          return false;
        }
      if (i < pktSize) return false;
      inStream.currentOffset = 0;
      socketStream.flushInputStream(inStream.buffer, pktSize);
      anInt1009 = 0;
      anInt843 = anInt842;
      anInt842 = anInt841;
      anInt841 = pktType;
      if (pktType == 81) {
        updatePlayers(pktSize, inStream);
        aBoolean1080 = false;
        pktType = -1;
        return true;
      }
      if (pktType == 176) {
        daysSinceRecovChange = inStream.method427();
        unreadMessages = inStream.method435();
        membersInt = inStream.readUnsignedByte();
        anInt1193 = inStream.method440();
        daysSinceLastLogin = inStream.readUnsignedWord();
        if (anInt1193 != 0 && openInterfaceID == -1) {
          SignLink.dnslookup(TextClass.method586(anInt1193));
          clearTopInterfaces();
          char c = '\u028A';
          if (daysSinceRecovChange != 201 || membersInt == 1) c = '\u028F';
          reportAbuseInput = "";
          canMute = false;
          for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
            if (RSInterface.interfaceCache[k9] == null
                || RSInterface.interfaceCache[k9].anInt214 != c) continue;
            openInterfaceID = RSInterface.interfaceCache[k9].parentID;
            break;
          }
        }
        pktType = -1;
        return true;
      }
      if (pktType == 64) {
        anInt1268 = inStream.method427();
        anInt1269 = inStream.method428();
        for (int j = anInt1268; j < anInt1268 + 8; j++) {
          for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
            if (groundArray[plane][j][l9] != null) {
              groundArray[plane][j][l9] = null;
              spawnGroundItem(j, l9);
            }
        }

        for (SpawnObjectNode class30_sub1 = (SpawnObjectNode) aClass19_1179.reverseGetFirst();
            class30_sub1 != null;
            class30_sub1 = (SpawnObjectNode) aClass19_1179.reverseGetNext())
          if (class30_sub1.anInt1297 >= anInt1268
              && class30_sub1.anInt1297 < anInt1268 + 8
              && class30_sub1.anInt1298 >= anInt1269
              && class30_sub1.anInt1298 < anInt1269 + 8
              && class30_sub1.anInt1295 == plane) class30_sub1.anInt1294 = 0;

        pktType = -1;
        return true;
      }
      if (pktType == 185) {
        int k = inStream.method436();
        RSInterface.interfaceCache[k].anInt233 = 3;
        if (myPlayer.desc == null)
          RSInterface.interfaceCache[k].mediaID =
              (myPlayer.anIntArray1700[0] << 25)
                  + (myPlayer.anIntArray1700[4] << 20)
                  + (myPlayer.equipment[0] << 15)
                  + (myPlayer.equipment[8] << 10)
                  + (myPlayer.equipment[11] << 5)
                  + myPlayer.equipment[1];
        else RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.type);
        pktType = -1;
        return true;
      }
      if (pktType == 107) {
        aBoolean1160 = false;
        for (int l = 0; l < 5; l++) aBooleanArray876[l] = false;

        pktType = -1;
        return true;
      }
      if (pktType == 72) {
        int i1 = inStream.method434();
        RSInterface class9 = RSInterface.interfaceCache[i1];
        for (int k15 = 0; k15 < class9.inv.length; k15++) {
          class9.inv[k15] = -1;
          class9.inv[k15] = 0;
        }

        pktType = -1;
        return true;
      }
      if (pktType == 214) {
        ignoreCount = pktSize / 8;
        for (int j1 = 0; j1 < ignoreCount; j1++) ignoreListAsLongs[j1] = inStream.readQWord();

        pktType = -1;
        return true;
      }
      if (pktType == 166) {
        aBoolean1160 = true;
        anInt1098 = inStream.readUnsignedByte();
        anInt1099 = inStream.readUnsignedByte();
        anInt1100 = inStream.readUnsignedWord();
        anInt1101 = inStream.readUnsignedByte();
        anInt1102 = inStream.readUnsignedByte();
        if (anInt1102 >= 100) {
          xCameraPos = anInt1098 * 128 + 64;
          yCameraPos = anInt1099 * 128 + 64;
          zCameraPos = method42(plane, yCameraPos, xCameraPos) - anInt1100;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 134) {
        needDrawTabArea = true;
        int k1 = inStream.readUnsignedByte();
        int i10 = inStream.method439();
        int l15 = inStream.readUnsignedByte();
        currentExp[k1] = i10;
        currentStats[k1] = l15;
        maxStats[k1] = 1;
        for (int k20 = 0; k20 < 98; k20++) if (i10 >= anIntArray1019[k20]) maxStats[k1] = k20 + 2;

        pktType = -1;
        return true;
      }
      if (pktType == 71) {
        int l1 = inStream.readUnsignedWord();
        int j10 = inStream.method426();
        if (l1 == 65535) l1 = -1;
        tabInterfaceIDs[j10] = l1;
        needDrawTabArea = true;
        tabAreaAltered = true;
        pktType = -1;
        return true;
      }
      if (pktType == 74) {
        int i2 = inStream.method434();
        if (i2 == 65535) i2 = -1;
        if (i2 != currentSong && musicEnabled && !lowMem && prevSong == 0) {
          nextSong = i2;
          songChanging = true;
          onDemandFetcher.method558(2, nextSong);
        }
        currentSong = i2;
        pktType = -1;
        return true;
      }
      if (pktType == 121) {
        int j2 = inStream.method436();
        int k10 = inStream.method435();
        if (musicEnabled && !lowMem) {
          nextSong = j2;
          songChanging = false;
          onDemandFetcher.method558(2, nextSong);
          prevSong = k10;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 109) {
        resetLogout();
        pktType = -1;
        return false;
      }
      if (pktType == 70) {
        int k2 = inStream.readSignedWord();
        int l10 = inStream.method437();
        int i16 = inStream.method434();
        RSInterface class9_5 = RSInterface.interfaceCache[i16];
        class9_5.anInt263 = k2;
        class9_5.anInt265 = l10;
        pktType = -1;
        return true;
      }
      if (pktType == 73 || pktType == 241) {

        // mapReset();
        int l2 = anInt1069;
        int i11 = anInt1070;
        if (pktType == 73) {
          l2 = inStream.method435();
          i11 = inStream.readUnsignedWord();
          aBoolean1159 = false;
        }
        if (pktType == 241) {
          i11 = inStream.method435();
          inStream.initBitAccess();
          for (int j16 = 0; j16 < 4; j16++) {
            for (int l20 = 0; l20 < 13; l20++) {
              for (int j23 = 0; j23 < 13; j23++) {
                int i26 = inStream.readBits(1);
                if (i26 == 1) anIntArrayArrayArray1129[j16][l20][j23] = inStream.readBits(26);
                else anIntArrayArrayArray1129[j16][l20][j23] = -1;
              }
            }
          }

          inStream.finishBitAccess();
          l2 = inStream.readUnsignedWord();
          aBoolean1159 = true;
        }
        if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
          pktType = -1;
          return true;
        }
        anInt1069 = l2;
        anInt1070 = i11;
        baseX = (anInt1069 - 6) * 8;
        baseY = (anInt1070 - 6) * 8;
        aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
        if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) aBoolean1141 = true;
        loadingStage = 1;
        aLong824 = System.currentTimeMillis();
        aRSImageProducer_1165.initDrawingArea();
        aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151, 257);
        aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.", 150, 256);
        aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
        if (pktType == 73) {
          int k16 = 0;
          for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
            for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) k16++;
          }

          aByteArrayArray1183 = new byte[k16][];
          aByteArrayArray1247 = new byte[k16][];
          anIntArray1234 = new int[k16];
          anIntArray1235 = new int[k16];
          anIntArray1236 = new int[k16];
          k16 = 0;
          for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
            for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
              anIntArray1234[k16] = (l23 << 8) + j26;
              if (aBoolean1141
                  && (j26 == 49
                      || j26 == 149
                      || j26 == 147
                      || l23 == 50
                      || l23 == 49 && j26 == 47)) {
                anIntArray1235[k16] = -1;
                anIntArray1236[k16] = -1;
                k16++;
              } else {
                int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
                if (k28 != -1) onDemandFetcher.method558(3, k28);
                int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
                if (j30 != -1) onDemandFetcher.method558(3, j30);
                k16++;
              }
            }
          }
        }
        if (pktType == 241) {
          int l16 = 0;
          int ai[] = new int[676];
          for (int i24 = 0; i24 < 4; i24++) {
            for (int k26 = 0; k26 < 13; k26++) {
              for (int l28 = 0; l28 < 13; l28++) {
                int k30 = anIntArrayArrayArray1129[i24][k26][l28];
                if (k30 != -1) {
                  int k31 = k30 >> 14 & 0x3ff;
                  int i32 = k30 >> 3 & 0x7ff;
                  int k32 = (k31 / 8 << 8) + i32 / 8;
                  for (int j33 = 0; j33 < l16; j33++) {
                    if (ai[j33] != k32) continue;
                    k32 = -1;
                    break;
                  }

                  if (k32 != -1) ai[l16++] = k32;
                }
              }
            }
          }

          aByteArrayArray1183 = new byte[l16][];
          aByteArrayArray1247 = new byte[l16][];
          anIntArray1234 = new int[l16];
          anIntArray1235 = new int[l16];
          anIntArray1236 = new int[l16];
          for (int l26 = 0; l26 < l16; l26++) {
            int i29 = anIntArray1234[l26] = ai[l26];
            int l30 = i29 >> 8 & 0xff;
            int l31 = i29 & 0xff;
            int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
            if (j32 != -1) onDemandFetcher.method558(3, j32);
            int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
            if (i33 != -1) onDemandFetcher.method558(3, i33);
          }
        }
        int i17 = baseX - anInt1036;
        int j21 = baseY - anInt1037;
        anInt1036 = baseX;
        anInt1037 = baseY;
        for (int j24 = 0; j24 < 16384; j24++) {
          NPC npc = sessionNPCs[j24];
          if (npc != null) {
            for (int j29 = 0; j29 < 10; j29++) {
              npc.smallX[j29] -= i17;
              npc.smallY[j29] -= j21;
            }

            npc.x -= i17 * 128;
            npc.y -= j21 * 128;
          }
        }

        for (int i27 = 0; i27 < maxPlayers; i27++) {
          Player player = playerArray[i27];
          if (player != null) {
            for (int i31 = 0; i31 < 10; i31++) {
              player.smallX[i31] -= i17;
              player.smallY[i31] -= j21;
            }

            player.x -= i17 * 128;
            player.y -= j21 * 128;
          }
        }

        aBoolean1080 = true;
        byte byte1 = 0;
        byte byte2 = 104;
        byte byte3 = 1;
        if (i17 < 0) {
          byte1 = 103;
          byte2 = -1;
          byte3 = -1;
        }
        byte byte4 = 0;
        byte byte5 = 104;
        byte byte6 = 1;
        if (j21 < 0) {
          byte4 = 103;
          byte5 = -1;
          byte6 = -1;
        }
        for (int k33 = byte1; k33 != byte2; k33 += byte3) {
          for (int l33 = byte4; l33 != byte5; l33 += byte6) {
            int i34 = k33 + i17;
            int j34 = l33 + j21;
            for (int k34 = 0; k34 < 4; k34++)
              if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
                groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
              else groundArray[k34][k33][l33] = null;
          }
        }

        for (SpawnObjectNode class30_sub1_1 = (SpawnObjectNode) aClass19_1179.reverseGetFirst();
            class30_sub1_1 != null;
            class30_sub1_1 = (SpawnObjectNode) aClass19_1179.reverseGetNext()) {
          class30_sub1_1.anInt1297 -= i17;
          class30_sub1_1.anInt1298 -= j21;
          if (class30_sub1_1.anInt1297 < 0
              || class30_sub1_1.anInt1298 < 0
              || class30_sub1_1.anInt1297 >= 104
              || class30_sub1_1.anInt1298 >= 104) class30_sub1_1.unlink();
        }

        if (destX != 0) {
          destX -= i17;
          destY -= j21;
        }
        aBoolean1160 = false;
        pktType = -1;
        return true;
      }
      if (pktType == 208) {
        int i3 = inStream.method437();
        if (i3 >= 0) writeInterface(i3);
        anInt1018 = i3;
        pktType = -1;
        return true;
      }
      if (pktType == 99) {
        anInt1021 = inStream.readUnsignedByte();
        pktType = -1;
        return true;
      }
      if (pktType == 75) {
        int j3 = inStream.method436();
        int j11 = inStream.method436();
        RSInterface.interfaceCache[j11].anInt233 = 2;
        RSInterface.interfaceCache[j11].mediaID = j3;
        pktType = -1;
        return true;
      }
      if (pktType == 114) {
        anInt1104 = inStream.method434() * 30;
        pktType = -1;
        return true;
      }
      if (pktType == 60) {
        anInt1269 = inStream.readUnsignedByte();
        anInt1268 = inStream.method427();
        while (inStream.currentOffset < pktSize) {
          int k3 = inStream.readUnsignedByte();
          manageModelCreations(inStream, k3);
        }
        pktType = -1;
        return true;
      }
      if (pktType == 35) {
        int l3 = inStream.readUnsignedByte();
        int k11 = inStream.readUnsignedByte();
        int j17 = inStream.readUnsignedByte();
        int k21 = inStream.readUnsignedByte();
        aBooleanArray876[l3] = true;
        anIntArray873[l3] = k11;
        anIntArray1203[l3] = j17;
        anIntArray928[l3] = k21;
        anIntArray1030[l3] = 0;
        pktType = -1;
        return true;
      }
      if (pktType == 174) {
        int i4 = inStream.readUnsignedWord();
        int l11 = inStream.readUnsignedByte();
        int k17 = inStream.readUnsignedWord();
        if (wave_on && !lowMem && anInt1062 < 50) {
          anIntArray1207[anInt1062] = i4;
          anIntArray1241[anInt1062] = l11;
          anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
          anInt1062++;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 104) {
        int j4 = inStream.method427();
        int i12 = inStream.method426();
        String s6 = inStream.readString();
        if (j4 >= 1 && j4 <= 5) {
          if (s6.equalsIgnoreCase("null")) s6 = null;
          atPlayerActions[j4 - 1] = s6;
          atPlayerArray[j4 - 1] = i12 == 0;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 78) {
        destX = 0;
        pktType = -1;
        return true;
      }
      if (pktType == 253) {
        String s = inStream.readString();
        if (s.endsWith(":tradereq:")) {
          String s3 = s.substring(0, s.indexOf(":"));
          long l17 = TextClass.longForName(s3);
          boolean flag2 = false;
          for (int j27 = 0; j27 < ignoreCount; j27++) {
            if (ignoreListAsLongs[j27] != l17) continue;
            flag2 = true;
            break;
          }

          if (!flag2 && anInt1251 == 0) pushMessage("wishes to trade with you.", 4, s3);
        } else if (s.endsWith(":duelreq:")) {
          String s4 = s.substring(0, s.indexOf(":"));
          long l18 = TextClass.longForName(s4);
          boolean flag3 = false;
          for (int k27 = 0; k27 < ignoreCount; k27++) {
            if (ignoreListAsLongs[k27] != l18) continue;
            flag3 = true;
            break;
          }

          if (!flag3 && anInt1251 == 0) pushMessage("wishes to duel with you.", 8, s4);
        } else if (s.endsWith(":chalreq:")) {
          String s5 = s.substring(0, s.indexOf(":"));
          long l19 = TextClass.longForName(s5);
          boolean flag4 = false;
          for (int l27 = 0; l27 < ignoreCount; l27++) {
            if (ignoreListAsLongs[l27] != l19) continue;
            flag4 = true;
            break;
          }

          if (!flag4 && anInt1251 == 0) {
            String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
            pushMessage(s8, 8, s5);
          }
        } else {
          pushMessage(s, 0, "");
        }
        pktType = -1;
        // serverMessage(s);

        return true;
      }
      if (pktType == 1) {
        for (int k4 = 0; k4 < playerArray.length; k4++)
          if (playerArray[k4] != null) playerArray[k4].anim = -1;

        for (int j12 = 0; j12 < sessionNPCs.length; j12++)
          if (sessionNPCs[j12] != null) sessionNPCs[j12].anim = -1;

        pktType = -1;
        return true;
      }
      if (pktType == 50) {
        long l4 = inStream.readQWord();
        int i18 = inStream.readUnsignedByte();
        String s7 = TextClass.fixName(TextClass.nameForLong(l4));
        for (int k24 = 0; k24 < friendsCount; k24++) {
          if (l4 != friendsListAsLongs[k24]) continue;
          if (friendsNodeIDs[k24] != i18) {
            friendsNodeIDs[k24] = i18;
            needDrawTabArea = true;
            if (i18 > 0) pushMessage(s7 + " has logged in.", 5, "");
            if (i18 == 0) pushMessage(s7 + " has logged out.", 5, "");
          }
          s7 = null;
          break;
        }

        if (s7 != null && friendsCount < 200) {
          friendsListAsLongs[friendsCount] = l4;
          friendsList[friendsCount] = s7;
          friendsNodeIDs[friendsCount] = i18;
          friendsCount++;
          needDrawTabArea = true;
        }
        for (boolean flag6 = false; !flag6; ) {
          flag6 = true;
          for (int k29 = 0; k29 < friendsCount - 1; k29++)
            if (friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID
                || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
              int j31 = friendsNodeIDs[k29];
              friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
              friendsNodeIDs[k29 + 1] = j31;
              String s10 = friendsList[k29];
              friendsList[k29] = friendsList[k29 + 1];
              friendsList[k29 + 1] = s10;
              long l32 = friendsListAsLongs[k29];
              friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
              friendsListAsLongs[k29 + 1] = l32;
              needDrawTabArea = true;
              flag6 = false;
            }
        }

        pktType = -1;
        return true;
      }
      if (pktType == 110) {
        if (tabID == 12) needDrawTabArea = true;
        energy = inStream.readUnsignedByte();
        pktType = -1;
        return true;
      }
      if (pktType == 254) {
        headiconDrawType = inStream.readUnsignedByte();
        if (headiconDrawType == 1) anInt1222 = inStream.readUnsignedWord();
        if (headiconDrawType >= 2 && headiconDrawType <= 6) {
          if (headiconDrawType == 2) {
            anInt937 = 64;
            anInt938 = 64;
          }
          if (headiconDrawType == 3) {
            anInt937 = 0;
            anInt938 = 64;
          }
          if (headiconDrawType == 4) {
            anInt937 = 128;
            anInt938 = 64;
          }
          if (headiconDrawType == 5) {
            anInt937 = 64;
            anInt938 = 0;
          }
          if (headiconDrawType == 6) {
            anInt937 = 64;
            anInt938 = 128;
          }
          headiconDrawType = 2;
          anInt934 = inStream.readUnsignedWord();
          anInt935 = inStream.readUnsignedWord();
          anInt936 = inStream.readUnsignedByte();
        }
        if (headiconDrawType == 10) anInt933 = inStream.readUnsignedWord();
        pktType = -1;
        return true;
      }
      if (pktType == 248) {
        int i5 = inStream.method435();
        int k12 = inStream.readUnsignedWord();
        if (backDialogID != -1) {
          backDialogID = -1;
          inputTaken = true;
        }
        if (inputDialogState != 0) {
          inputDialogState = 0;
          inputTaken = true;
        }
        openInterfaceID = i5;
        invOverlayInterfaceID = k12;
        needDrawTabArea = true;
        tabAreaAltered = true;
        aBoolean1149 = false;
        pktType = -1;
        return true;
      }
      if (pktType == 79) {
        int j5 = inStream.method434();
        int l12 = inStream.method435();
        RSInterface class9_3 = RSInterface.interfaceCache[j5];
        if (class9_3 != null && class9_3.type == 0) {
          if (l12 < 0) l12 = 0;
          if (l12 > class9_3.scrollMax - class9_3.height)
            l12 = class9_3.scrollMax - class9_3.height;
          class9_3.scrollPosition = l12;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 68) {
        for (int k5 = 0; k5 < variousSettings.length; k5++)
          if (variousSettings[k5] != anIntArray1045[k5]) {
            variousSettings[k5] = anIntArray1045[k5];
            adjustVolume(k5);
            needDrawTabArea = true;
          }

        pktType = -1;
        return true;
      }
      if (pktType == 196) {
        long l5 = inStream.readQWord();
        int j18 = inStream.readDWord();
        int l21 = inStream.readUnsignedByte();
        boolean flag5 = false;
        for (int i28 = 0; i28 < 100; i28++) {
          if (anIntArray1240[i28] != j18) continue;
          flag5 = true;
          break;
        }

        if (l21 <= 1) {
          for (int l29 = 0; l29 < ignoreCount; l29++) {
            if (ignoreListAsLongs[l29] != l5) continue;
            flag5 = true;
            break;
          }
        }
        if (!flag5 && anInt1251 == 0)
          try {
            anIntArray1240[anInt1169] = j18;
            anInt1169 = (anInt1169 + 1) % 100;
            String s9 = TextInput.method525(pktSize - 13, inStream);
            if (l21 != 3) s9 = Censor.doCensor(s9);
            if (l21 == 2 || l21 == 3)
              pushMessage(s9, 7, "@cr2@" + TextClass.fixName(TextClass.nameForLong(l5)));
            else if (l21 == 1)
              pushMessage(s9, 7, "@cr1@" + TextClass.fixName(TextClass.nameForLong(l5)));
            else pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(l5)));
          } catch (Exception exception1) {
            SignLink.reporterror("cde1");
          }
        pktType = -1;
        return true;
      }
      if (pktType == 85) {
        anInt1269 = inStream.method427();
        anInt1268 = inStream.method427();
        pktType = -1;
        return true;
      }
      if (pktType == 24) {
        anInt1054 = inStream.method428();
        if (anInt1054 == tabID) {
          if (anInt1054 == 3) tabID = 1;
          else tabID = 3;
          needDrawTabArea = true;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 246) {
        int i6 = inStream.method434();
        int i13 = inStream.readUnsignedWord();
        int k18 = inStream.readUnsignedWord();
        if (k18 == 65535) {
          RSInterface.interfaceCache[i6].anInt233 = 0;
          pktType = -1;
          return true;
        } else {
          ItemDef itemDef = ItemDef.forID(k18);
          RSInterface.interfaceCache[i6].anInt233 = 4;
          RSInterface.interfaceCache[i6].mediaID = k18;
          RSInterface.interfaceCache[i6].anInt270 = itemDef.modelRotation1;
          RSInterface.interfaceCache[i6].anInt271 = itemDef.modelRotation2;
          RSInterface.interfaceCache[i6].anInt269 = (itemDef.modelZoom * 100) / i13;
          pktType = -1;
          return true;
        }
      }
      if (pktType == 171) {
        boolean flag1 = inStream.readUnsignedByte() == 1;
        int j13 = inStream.readUnsignedWord();
        RSInterface.interfaceCache[j13].aBoolean266 = flag1;
        pktType = -1;
        return true;
      }
      if (pktType == 142) {
        int j6 = inStream.method434();
        writeInterface(j6);
        if (backDialogID != -1) {
          backDialogID = -1;
          inputTaken = true;
        }
        if (inputDialogState != 0) {
          inputDialogState = 0;
          inputTaken = true;
        }
        invOverlayInterfaceID = j6;
        needDrawTabArea = true;
        tabAreaAltered = true;
        openInterfaceID = -1;
        aBoolean1149 = false;
        pktType = -1;
        return true;
      }
      if (pktType == 126) {
        String s1 = inStream.readString();
        int k13 = inStream.method435();
        RSInterface.interfaceCache[k13].message = s1;
        if (RSInterface.interfaceCache[k13].parentID == tabInterfaceIDs[tabID])
          needDrawTabArea = true;
        pktType = -1;
        return true;
      }
      if (pktType == 206) {
        publicChatMode = inStream.readUnsignedByte();
        privateChatMode = inStream.readUnsignedByte();
        tradeMode = inStream.readUnsignedByte();
        aBoolean1233 = true;
        inputTaken = true;
        pktType = -1;
        return true;
      }
      if (pktType == 240) {
        if (tabID == 12) needDrawTabArea = true;
        weight = inStream.readSignedWord();
        pktType = -1;
        return true;
      }
      if (pktType == 8) {
        int k6 = inStream.method436();
        int l13 = inStream.readUnsignedWord();
        RSInterface.interfaceCache[k6].anInt233 = 1;
        RSInterface.interfaceCache[k6].mediaID = l13;
        pktType = -1;
        return true;
      }
      if (pktType == 122) {
        int l6 = inStream.method436();
        int i14 = inStream.method436();
        int i19 = i14 >> 10 & 0x1f;
        int i22 = i14 >> 5 & 0x1f;
        int l24 = i14 & 0x1f;
        RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
        pktType = -1;
        return true;
      }
      if (pktType == 53) {
        needDrawTabArea = true;
        int i7 = inStream.readUnsignedWord();
        RSInterface class9_1 = RSInterface.interfaceCache[i7];
        int j19 = inStream.readUnsignedWord();
        for (int j22 = 0; j22 < j19; j22++) {
          int i25 = inStream.readUnsignedByte();
          if (i25 == 255) i25 = inStream.method440();
          class9_1.inv[j22] = inStream.method436();
          class9_1.invStackSizes[j22] = i25;
        }

        for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
          class9_1.inv[j25] = 0;
          class9_1.invStackSizes[j25] = 0;
        }

        pktType = -1;
        return true;
      }
      if (pktType == 230) {
        int j7 = inStream.method435();
        int j14 = inStream.readUnsignedWord();
        int k19 = inStream.readUnsignedWord();
        int k22 = inStream.method436();
        RSInterface.interfaceCache[j14].anInt270 = k19;
        RSInterface.interfaceCache[j14].anInt271 = k22;
        RSInterface.interfaceCache[j14].anInt269 = j7;
        pktType = -1;
        return true;
      }
      if (pktType == 221) {
        anInt900 = inStream.readUnsignedByte();
        needDrawTabArea = true;
        pktType = -1;
        return true;
      }
      if (pktType == 177) {
        aBoolean1160 = true;
        anInt995 = inStream.readUnsignedByte();
        anInt996 = inStream.readUnsignedByte();
        anInt997 = inStream.readUnsignedWord();
        anInt998 = inStream.readUnsignedByte();
        anInt999 = inStream.readUnsignedByte();
        if (anInt999 >= 100) {
          int k7 = anInt995 * 128 + 64;
          int k14 = anInt996 * 128 + 64;
          int i20 = method42(plane, k14, k7) - anInt997;
          int l22 = k7 - xCameraPos;
          int k25 = i20 - zCameraPos;
          int j28 = k14 - yCameraPos;
          int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
          yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
          xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
          if (yCameraCurve < 128) yCameraCurve = 128;
          if (yCameraCurve > 383) yCameraCurve = 383;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 249) {
        anInt1046 = inStream.method426();
        unknownInt10 = inStream.method436();
        pktType = -1;
        return true;
      }
      if (pktType == 65) {
        updateNPCs(inStream, pktSize);
        pktType = -1;
        return true;
      }
      if (pktType == 27) {
        messagePromptRaised = false;
        inputDialogState = 1;
        amountOrNameInput = "";
        inputTaken = true;
        pktType = -1;
        return true;
      }
      if (pktType == 187) {
        messagePromptRaised = false;
        inputDialogState = 2;
        amountOrNameInput = "";
        inputTaken = true;
        pktType = -1;
        return true;
      }
      if (pktType == 97) {
        int l7 = inStream.readUnsignedWord();
        writeInterface(l7);
        if (invOverlayInterfaceID != -1) {
          invOverlayInterfaceID = -1;
          needDrawTabArea = true;
          tabAreaAltered = true;
        }
        if (backDialogID != -1) {
          backDialogID = -1;
          inputTaken = true;
        }
        if (inputDialogState != 0) {
          inputDialogState = 0;
          inputTaken = true;
        }
        openInterfaceID = l7;
        aBoolean1149 = false;
        pktType = -1;
        return true;
      }
      if (pktType == 218) {
        int i8 = inStream.method438();
        dialogID = i8;
        inputTaken = true;
        pktType = -1;
        return true;
      }
      if (pktType == 87) {
        int j8 = inStream.method434();
        int l14 = inStream.method439();
        anIntArray1045[j8] = l14;
        if (variousSettings[j8] != l14) {
          variousSettings[j8] = l14;
          adjustVolume(j8);
          needDrawTabArea = true;
          if (dialogID != -1) inputTaken = true;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 36) {
        int k8 = inStream.method434();
        byte byte0 = inStream.readSignedByte();
        anIntArray1045[k8] = byte0;
        if (variousSettings[k8] != byte0) {
          variousSettings[k8] = byte0;
          adjustVolume(k8);
          needDrawTabArea = true;
          if (dialogID != -1) inputTaken = true;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 61) {
        anInt1055 = inStream.readUnsignedByte();
        pktType = -1;
        return true;
      }
      if (pktType == 200) {
        int l8 = inStream.readUnsignedWord();
        int i15 = inStream.readSignedWord();
        RSInterface class9_4 = RSInterface.interfaceCache[l8];
        class9_4.anInt257 = i15;
        if (i15 == -1) {
          class9_4.anInt246 = 0;
          class9_4.anInt208 = 0;
        }
        pktType = -1;
        return true;
      }
      if (pktType == 219) {
        if (invOverlayInterfaceID != -1) {
          invOverlayInterfaceID = -1;
          needDrawTabArea = true;
          tabAreaAltered = true;
        }
        if (backDialogID != -1) {
          backDialogID = -1;
          inputTaken = true;
        }
        if (inputDialogState != 0) {
          inputDialogState = 0;
          inputTaken = true;
        }
        openInterfaceID = -1;
        aBoolean1149 = false;
        pktType = -1;
        return true;
      }
      if (pktType == 34) {
        needDrawTabArea = true;
        int i9 = inStream.readUnsignedWord();
        RSInterface class9_2 = RSInterface.interfaceCache[i9];
        while (inStream.currentOffset < pktSize) {
          int j20 = inStream.method422();
          int i23 = inStream.readUnsignedWord();
          int l25 = inStream.readUnsignedByte();
          if (l25 == 255) l25 = inStream.readDWord();
          if (j20 >= 0 && j20 < class9_2.inv.length) {
            class9_2.inv[j20] = i23;
            class9_2.invStackSizes[j20] = l25;
          }
        }
        pktType = -1;
        return true;
      }
      if (pktType == 105
          || pktType == 84
          || pktType == 147
          || pktType == 215
          || pktType == 4
          || pktType == 117
          || pktType == 156
          || pktType == 44
          || pktType == 160
          || pktType == 101
          || pktType == 151) {
        manageModelCreations(inStream, pktType);
        pktType = -1;
        return true;
      }
      if (pktType == 106) {
        tabID = inStream.method427();
        needDrawTabArea = true;
        tabAreaAltered = true;
        pktType = -1;
        return true;
      }
      if (pktType == 164) {
        int j9 = inStream.method434();
        writeInterface(j9);
        if (invOverlayInterfaceID != -1) {
          invOverlayInterfaceID = -1;
          needDrawTabArea = true;
          tabAreaAltered = true;
        }
        backDialogID = j9;
        inputTaken = true;
        openInterfaceID = -1;
        aBoolean1149 = false;
        pktType = -1;
        return true;
      }
      SignLink.reporterror("T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843);
      resetLogout();
    } catch (IOException _ex) {
      dropClient();
    } catch (Exception exception) {
      String s2 =
          "T2 - "
              + pktType
              + ","
              + anInt842
              + ","
              + anInt843
              + " - "
              + pktSize
              + ","
              + (baseX + myPlayer.smallX[0])
              + ","
              + (baseY + myPlayer.smallY[0])
              + " - ";
      for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) s2 = s2 + inStream.buffer[j15] + ",";

      SignLink.reporterror(s2);
      resetLogout();
    }
    return true;
  }
Пример #30
0
 public void testReadNextAttributeValue2() {
   final TextInput ti =
       new TextInput("<Head  this=\">is not \n the end\" we\n=\tzorg   " + " go   =    \"hi");
   try {
     System.out.println("attribute=" + ti.readNextAttributeValue());
     fail("Exception expected"); // now we have the value
   } catch (RuntimeException e) {
     // OK
   }
   ti.read(); // skip <
   try {
     System.out.println("attribute=" + ti.readNextAttributeValue());
     fail("Exception expected"); // now we have the value
   } catch (RuntimeException e) {
     // OK
   }
   assertEquals("Head", ti.readNextXmlName());
   try {
     System.out.println("attribute=" + ti.readNextAttributeValue());
     fail("Exception expected"); // now we have the value
   } catch (RuntimeException e) {
     // OK
   }
   assertEquals("this", ti.readNextXmlName());
   assertEquals(">is not \n the end", ti.readNextAttributeValue());
   assertEquals("we", ti.readNextXmlName());
   assertEquals("zorg", ti.readNextAttributeValue());
   assertEquals("go", ti.readNextXmlName());
   try {
     System.out.println("attribute=" + ti.readNextAttributeValue());
     fail("Exception expected"); // now we have the value
   } catch (RuntimeException e) {
     // OK
   }
 }