Example #1
0
  // Removes any NPCs that have zero remaining life
  public void NPCclean(ArrayList<NPC> npc) {
    for (NPC n : npc) {

      if (n.getLife() <= 0) {
        Music.playDeath();
        remove.add(n);
      }
    }

    clearList(npc);
  }
Example #2
0
  /**
   * Opens the nearest bank if it is within range to walk to it. It does not generate a path to the
   * bank, just simply opens the nearest.
   *
   * @return True if the bank has been opened.
   */
  public boolean openClosestBank() {
    PhysicalObject booth = botEnv.objects.getClosestObject(20, BANK_BOOTH_IDS);
    NPC banker = botEnv.npcs.getClosest(20, BANKER_IDS);
    PhysicalObject chest = botEnv.objects.getClosestObject(20, BANK_CHEST_IDS);

    Object targetObject = null;
    String action = null;

    if (booth != null) {
      targetObject = booth;
      action = "Use-quickly";
    } else if (banker != null) {
      targetObject = banker;
      action = "Bank banker";
    } else if (chest != null) {
      targetObject = chest;
      action = "Use";
    }
    if (targetObject != null) {
      NPC targetNPC = null;
      PhysicalObject targetPhysObject = null;
      if (targetObject instanceof NPC) {
        targetNPC = (NPC) targetObject;
      } else {
        targetPhysObject = (PhysicalObject) targetObject;
      }
      if (targetNPC != null) {
        if (botEnv.players.getMyPlayer().distanceTo(targetNPC.getLocation()) > 8) {
          if (botEnv.walking.walkToMM(targetNPC.getLocation())) {
            sleep(300, 600);
            while (botEnv.players.getMyPlayer().isMoving()) sleep(100);
          } else {
            return false;
          }
        }
        return targetNPC.doAction(action);
      } else {
        if (botEnv.players.getMyPlayer().distanceTo(targetPhysObject.getLocation()) > 8) {
          if (botEnv.walking.walkToMM(targetPhysObject.getLocation())) {
            sleep(300, 600);
            while (botEnv.players.getMyPlayer().isMoving()) sleep(100);
          } else {
            return false;
          }
        }
        return targetPhysObject.doAction(action);
      }
    }
    return false;
  }
Example #3
0
  /**
   * This main is used to test the file reader.
   *
   * @param str
   */
  public static void main(String[] str) {
    FileReader reader = new FileReader("res/dialogue.txt");

    int[] NPC_ID = reader.getNPC_ID();
    String[][] dialogue = reader.getParsedDialogue();

    NPC oldLady = new NPC(1, 1);
    oldLady.setID(1);

    // oldLady.getDialogue(0);
    // oldLady.getDialogue(1);

    System.out.println("----------TO STRING----------");
    reader.toString();
  }
Example #4
0
 @Override
 public void initialAnimate(int sX, int sY) {
   super.initialAnimate(sX, sY);
   for (MovePoint p : movePoints) {
     p.x += sX;
     p.y += sY;
   }
 }
Example #5
0
 @Override
 public void basicAnimate() {
   super.basicAnimate();
   for (MovePoint p : movePoints) {
     p.x += owner.getScrollX();
     p.y += owner.getScrollY();
   }
 };
Example #6
0
 public void render() {
   glPushMatrix();
   {
     glClearColor(0, 0, 0, 0);
     glColor4f(255, 255, 255, 255);
     tileMap.render();
     player.render(tileMap.getX(), tileMap.getY());
     chat.render();
     robot.render();
   }
   glPopMatrix();
 }
Example #7
0
 public void getInput() {
   if (Keyboard.isKeyDown(Keyboard.KEY_Z)) {
     if (!pressed) {
       robot.path();
       pressed = true;
     }
   }
   if (Keyboard.isKeyDown(Keyboard.KEY_P)) {
     pressed = false;
   }
   player.getInput();
 }
Example #8
0
  @Override
  public void h() {
    super.h();
    this.C();

    npc.onTick();
    if (world
            .getType(MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ))
            .getMaterial()
        == Material.FIRE) {
      setOnFire(15);
    }

    // Apply velocity etc.
    this.motY = onGround ? Math.max(0.0, motY) : motY;
    move(motX, motY, motZ);
    this.motX *= 0.800000011920929;
    this.motY *= 0.800000011920929;
    this.motZ *= 0.800000011920929;
    if (gravity && !this.onGround) {
      this.motY -= 0.1; // Most random value, don't judge.
    }
  }
Example #9
0
  public void update() {

    // keyboard input
    input();

    // check the events flags
    eventClear = player.clearedLevel();
    eventDead = player.isDead();
    eventCaught = player.isCaught();

    if (eventIntro) {
      // title update
      player.setPlaying(false);
      if (titleIntroA != null) {
        titleIntroA.update();
        if (titleIntroA.shouldRemove()) {
          titleIntroA = null;
          titleIntroB.start();
        }
      }
      if (titleIntroB != null) {
        titleIntroB.update();
        if (titleIntroB.shouldRemove()) {
          titleIntroB = null;
          eventIntro = false;
          player.setPlaying(true);
        }
      }
    }

    if (eventClear || eventDead || eventCaught) player.stop();

    if (eventClear) {
      if (!playFlag) {
        AudioPlayer.stop(musicFnm);
        AudioPlayer.playAndLoop("levelclear");
        playFlag = true;
      }
      PlayerData.setScore(player.getScore());
      PlayerData.addEatenDishes(player.getEatenDishes());
      if (showResults) showResults();
      if (!titleClear.hasStarted()) titleClear.start();
    }

    if (eventCaught) {
      if (!playFlag) {
        AudioPlayer.stop(musicFnm);
        AudioPlayer.play("levelfailcaught");
        playFlag = true;
      }
      if (!titleCaught.hasStarted()) titleCaught.start();
      if (titleCaught.shouldRemove()) titleCaught = null;
    }

    if (eventDead) {
      if (!playFlag) {
        AudioPlayer.stop(musicFnm);
        AudioPlayer.play("levelfaildead");
        playFlag = true;
      }
      if (!titleDead.hasStarted()) titleDead.start();
      if (titleDead.shouldRemove()) titleDead = null;
    }

    camera.setPosition(playerxscreen - player.getx(), 0);

    player.update();

    /*
    bgSky.setPosition(camera.getx() * 0.6, camera.gety() + bgSky.gety());
    bgSoil.setPosition(camera.getx(), camera.gety() + bgSoil.gety());

    bgSky.update();
    bgSoil.update();
    */

    bgKitchen.setPosition(camera.getx(), camera.gety());
    bgKitchen.update();

    for (int i = 0; i < numbers.size(); i++) {
      numbers.get(i).update();
      if (numbers.get(i).isOver()) {
        numbers.remove(i);
        i--;
      }
    }

    for (int i = 0; i < explosions.size(); i++) {
      SpriteAnimation explosion = explosions.get(i);
      explosion.update();
      if (explosion.hasPlayedOnce()) {
        explosions.remove(i);
        i--;
      }
    }
    for (int i = 0; i < powerup.size(); i++) {
      SpriteAnimation pup = powerup.get(i);
      pup.update();
      if (pup.hasPlayedOnce()) {
        powerup.remove(i);
        i--;
      }
    }

    // collisionDetection();
    for (int i = 0; i < dishes.size(); i++) {
      // dishes.get(i).setPosition(400 - player.getx(), dishes.get(i).gety());
      dishes.get(i).update();
      if (dishes.get(i).shouldRemove()) {
        dishes.remove(i);
        i--;
      }
    }
    hud.update();
    npc.update();

    if (player.getCholesterol() >= 85) {
      heartAttack.update();
      if (heartAttack.shouldPlaySound()) if (player.isPlaying()) AudioPlayer.play("heartbeat");
    }
    if (player.getCholesterol() <= 25) {
      warning.update();
      if (warning.shouldPlaySound()) if (player.isPlaying()) AudioPlayer.play("redalert");
    }

    levelIntroTimerDiff = (System.nanoTime() - levelIntroTimer) / 1000000;
    if (levelIntroTimerDiff > levelIntroDelay) levelStart = true;

    if (eventIntro || eventClear || eventDead || eventCaught) return;
    addDish();
  }
Example #10
0
  public void NPCFire(NPC n, FireControl fc) throws IOException {

    // Is player above the npc
    if (n.getY() <= n.getGotoy()
        && ((n.getX() + n.getWidth() / 2 <= n.getGotox() + 25)
            && n.getX() + n.getWidth() / 2 >= n.getGotox()
            && n.getFirer() < n.getDistancey())) {

      // System.out.println("Shooting!");
      fc.addShot(
          new Bullet(
              n.getX() + n.getWidth() / 2,
              n.getY() + n.getHeight() + 4,
              n.getGun().getShotwidth(),
              n.getGun().getShotwidth(),
              0,
              n.getGun().getShotspeed(),
              n,
              n.getGun().getRicochet()));
    }

    if (n.getY() >= n.getGotoy()
        && ((n.getX() + n.getWidth() / 2 <= n.getGotox() + 25)
            && n.getX() + n.getWidth() / 2 >= n.getGotox()
            && n.getFirer() < n.getDistancey())) {

      // System.out.println("Shooting!");
      fc.addShot(
          new Bullet(
              n.getX() + n.getWidth() / 2,
              n.getY() - 4,
              n.getGun().getShotwidth(),
              n.getGun().getShotwidth(),
              1,
              n.getGun().getShotspeed(),
              n,
              n.getGun().getRicochet()));
    }

    if ((n.getY() + n.getHeight() / 2 >= n.getGotoy())
        && n.getY() + n.getHeight() / 2 <= n.getGotoy() + 25
        && ((n.getX() >= n.getGotox()) && n.getFirer() <= n.getDistancex())) {

      // System.out.println("Shooting!");
      fc.addShot(
          new Bullet(
              n.getX() - 4,
              n.getY() + n.getHeight() / 2,
              n.getGun().getShotwidth(),
              n.getGun().getShotwidth(),
              2,
              n.getGun().getShotwidth(),
              n,
              n.getGun().getRicochet()));
    }

    if ((n.getY() + n.getHeight() / 2 >= n.getGotoy())
        && n.getY() + n.getHeight() / 2 <= n.getGotoy() + 25
        && ((n.getX() < n.getGotox()) && n.getFirer() <= n.getDistancex())) {

      // System.out.println("Shooting!");
      fc.addShot(
          new Bullet(
              n.getX() + n.getWidth() + 4,
              n.getY() + n.getHeight() / 2,
              n.getGun().getShotwidth(),
              n.getGun().getShotwidth(),
              3,
              n.getGun().getShotspeed(),
              n,
              n.getGun().getRicochet()));
    }
  }
Example #11
0
 public void update() {
   chat.update();
   player.update();
   tileMap.update((1280 / 2) - (int) player.getX(), (720 / 2) - (int) player.getY());
   robot.update();
 }
 public void allocateMoney(NPC npc) {
   BigDecimal money = npc.getTotalUnallocatedMoney(npc.getCurrency()).divide(new BigDecimal(5));
   Debug.print(money.toString() + npc.getCurrency());
   Debug.print("///////////////////////////New NPC\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
   this.Begin.buy(money, npc.getCurrency(), npc);
 }
Example #13
0
  public void input() {
    if (player.isPlaying())
      if (Keys.isPressed(Keys.ESCAPE) || Keys.isPressed(Keys.ENTER)) gsm.setPaused(true);
    if (!eventCaught && !eventDead && !eventClear) {
      if (Keys.isPressed(Keys.UP)) {
        player.setUp();
        npc.setUp();
      }
      if (Keys.isPressed(Keys.DOWN)) {
        player.setDown();
        npc.setDown();
      }
      if (Keys.isPressed(Keys.SPACE)) player.setJumping();
      if (Keys.isPressed(Keys.RIGHT)) player.setAccelerating();
    }

    if (eventCaught) {
      if (Keys.isPressed(Keys.ENTER)) {
        AudioPlayer.stop("levelfailcaught");
        gsm.setState(GameStateManager.MENU);
        ImagesLoader.removeImages("nivel3_imagenes.txt");
        ImagesLoader.removeImages("player_imagenes.txt");
        ImagesLoader.removeImages("npc_imagenes.txt");
        ImagesLoader.removeImages("hud_imagenes.txt");
        ImagesLoader.removeImages("nivel_efectosvisuales_imagenes.txt");
        AudioLoader.removeAudio("nivel3_sonido.txt");
      }
    }
    if (eventDead) {
      if (Keys.isPressed(Keys.ENTER)) {
        AudioPlayer.stop("levelfaildead");
        gsm.setState(GameStateManager.MENU);
        ImagesLoader.removeImages("nivel3_imagenes.txt");
        ImagesLoader.removeImages("player_imagenes.txt");
        ImagesLoader.removeImages("npc_imagenes.txt");
        ImagesLoader.removeImages("hud_imagenes.txt");
        ImagesLoader.removeImages("nivel_efectosvisuales_imagenes.txt");
        AudioLoader.removeAudio("nivel3_sonido.txt");
      }
    }
    if (eventClear) {
      if (Keys.isPressed(Keys.ENTER)) {
        if (!showResults) {
          showResults = true;
          resultsStartTime = System.nanoTime();
          return;
        }
        if (ticksResults > 65) {
          eventPoints = true;
          if (nextLevel) {
            AudioPlayer.play("menu_skip");
            AudioPlayer.stop("levelclear");
            ImagesLoader.removeImages("nivel3_imagenes.txt");
            AudioLoader.removeAudio("nivel3_sonido.txt");
            gsm.setState(nextState);
          }
        }
      }

      /*
      if(Keys.isPressed(Keys.ENTER)) {
             AudioPlayer.stop("levelclear");
             gsm.setState(GameStateManager.Level3);
         }
         */
    }
  }
Example #14
0
  public void init() {

    // LEVEL SPEED
    levelSpeed = 8;

    // AudioPlayer init
    AudioLoader.loadFromFile("nivel3_sonido.txt");

    // images loading
    ImagesLoader.loadFromFile("nivel3_imagenes.txt");
    ImagesLoader.loadFromFile("nivel_efectosvisuales_imagenes.txt");
    ImagesLoader.loadFromFile("food_imagenes.txt");

    // food appearance probability
    if (difficulty == OptionsState.EASY) foodprobability = 0.8;
    if (difficulty == OptionsState.NORMAL) foodprobability = 0.88;
    if (difficulty == OptionsState.HARD) foodprobability = 0.94;

    fooddelays = new int[6];
    fooddelays[0] = 100;
    fooddelays[1] = 600;
    fooddelays[2] = 100;
    fooddelays[3] = 500;
    fooddelays[4] = 100;
    fooddelays[5] = 400;

    // Events init
    eventIntro = true;
    eventClear = eventDead = eventCaught = false;

    txtAnimation = new TextAnimation();

    camera = new Camera();
    cameraPoint = new Camera();

    levelStart = false;
    levelIntroTimer = System.nanoTime();
    levelIntroDelay = 10000;

    foodTimer = System.nanoTime();
    foodDelay = 3000;

    // load fonts
    Text.loadFont("yummyFont.png");
    Text.loadFont("leishoFont.png");

    player = new Player();
    npc = new NPC(player);
    dishes = new ArrayList<>();
    hud = new HUD(player);

    // difficulty
    difficulty = OptionsData.getDifficulty();

    // rails init
    rails = new Rail[3];

    // title init
    titleIntroA = new Title(levelName, Title.INTROANIMATIONA);
    titleIntroB = new Title("EMPIEZA", Title.INTROANIMATIONB);
    titleClear = new Title("GANASTE", Title.CLEARANIMATION);
    titleDead = new Title("MORISTE", Title.CAUGHTANIMATION);
    titleCaught = new Title("ATRAPADO", Title.CAUGHTANIMATION);

    titleIntroA.start();

    // background creation
    // individual creation

    bgKitchen = new Background(0, 0, ImagesLoader.getImage("3_background"), Background.MOVELEFT);
    heartAttack =
        new BackgroundAnimation(
            ImagesLoader.getImage("heartsolo"), BackgroundAnimation.HEARTATTACK);
    warning =
        new BackgroundAnimation(ImagesLoader.getImage("warning"), BackgroundAnimation.WARNING);
    /*
    bgSky = new Background(0, 0, ImagesLoader.getImage("nivel1_clouds"));
    bgSoil = new Background(0, GamePanel.HEIGHT - (ImagesLoader.getHeight("nivel1_soil")),
            ImagesLoader.getImage("nivel1_soil"));
    */
    numbers = new ArrayList<>();
    explosions = new ArrayList<>();
    powerup = new ArrayList<>();
    player.init(dishes, numbers, explosions, powerup);

    // setting the score for the player
    player.setScore(PlayerData.getScore());

    foodValues = new HashMap<>();
    foodList = new ArrayList<>();
    powerList = new ArrayList<>();

    loadFoodFile("archivoComida.txt");

    powerList.add("FREEZEPOWER");
    powerList.add("DOUBLESCOREPOWER");
    powerList.add("DOUBLESPEEDPOWER");
    powerList.add("HALFSPEEDPOWER");

    // set position
    // debugging
    player.setPositionInRail(playerxscreen, player.getCurrentRail());
    cameraPoint.setPosition(playerxscreen, 0);

    // player.setVector(levelSpeed, 0);
    // parameters to be given: dx, dy, moveSpeed, jumpStart, fallSpeed
    player.setSpeed(levelSpeed, 0, 3.6, -28.8, 1.8);
    cameraPoint.setVector(levelSpeed, 0);

    npc.setPositionInRail(-npc.getWidth() / 2, npc.getCurrentRail());
    // npc.setVector(levelSpeed, 0);
    // parameters to be given: dx, dy, moveSpeed
    npc.setSpeed(levelSpeed, 0, 3.6);

    player.setCamera(camera);
    npc.setCamera(camera);

    // results stuff init
    squarewidth = 5;
    squareheight = 1;
    resultsDelay = 600;
    ticksResults = 0;

    // AudioPlayer volume setting
    // AudioPlayer.setVolume("musicFnm", -5.0f);
    AudioPlayer.setVolume("increasescore", -25.0f);

    // AudioPlayer bg play
    AudioPlayer.playAndLoop(musicFnm);
  }
Example #15
0
  // Sets the location for NPCs to move towards
  public void NPCTarget(Stage s, ArrayList<NPC> npc, Player p) {

    int playerx = p.getX();
    int playery = p.getY();
    int viewrange = 100;
    int npcx;
    int npcy;

    int randnext = 0;

    // For each npc
    for (NPC n : npc) {

      // Get X/Y
      npcx = n.getX();
      npcy = n.getY();
      randnext = rand.nextInt(10);

      // If npc has nowhere to go
      if (n.getMoveticks() == 0 || (n.getGotox() == n.getX() && n.getGotoy() == n.getY())) {

        // Set random amount of movements
        n.setMoveticks(rand.nextInt(150));
        // Set a direction
        n.setDirection(rand.nextInt(4));

        n.setGotox(0);
        n.setGotoy(0);
      }

      // check if the player is within view range and move
      if ((playery >= npcy && playery <= npcy + viewrange
              || playery <= npcy && playery >= npcy - viewrange)
          && playerx > (npcx + n.getWidth())
          && playerx <= (npcx + viewrange)) {

        n.setGotox(p.getX() + (p.getWidth() / 2));
        n.setGotoy(p.getY() + (p.getHeight() / 2));
      }

      if ((playery >= npcy && playery <= npcy + viewrange
              || playery <= npcy && playery >= npcy - viewrange)
          && (playerx + p.getWidth()) < npcx
          && playerx > (npcx - viewrange)) {

        n.setGotox(p.getX() + (p.getWidth() / 2));
        n.setGotoy(p.getY() + (p.getHeight() / 2));
      }
    }
  }
Example #16
0
 @Override
 public void restoreFromBundle(Bundle bundle) {
   super.restoreFromBundle(bundle);
   spawn(bundle.getInt(LEVEL));
 }
Example #17
0
 @Override
 public void storeInBundle(Bundle bundle) {
   super.storeInBundle(bundle);
   bundle.put(LEVEL, level);
 }
Example #18
0
 @Override
 public void stopWalking() {
   super.stopWalking();
 }
Example #19
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;
  }
Example #20
0
 public void positionBerechnen(ArrayList<Hindernis> hindernisse) {
   super.positionBerechnen(hindernisse);
   cooldown -= 25;
 }
Example #21
0
  // Controls movement of NPCs towards their set location
  public void NPCMove(Stage s, ArrayList<NPC> npc, FireControl fc) throws IOException {

    // For each NPC
    for (NPC n : npc) {

      // Set Random Movement - when no target is in sight
      if (n.getGotox() == 0 && n.getGotoy() == 0) {

        if (n.getDirection() == 0) {
          if (PlayerInput.checkUp(n, s) == true) {

            n.findwalk();
            n.setY(n.getY() + npcmove);
            n.setMoveticks(n.getMoveticks() - 1);
          } else n.setDirection(rand.nextInt(4));
        }

        if (n.getDirection() == 1) {
          if (PlayerInput.checkDown(n, s) == true) {
            n.findwalk();
            n.setY(n.getY() - npcmove);
            n.setMoveticks(n.getMoveticks() - 1);
          } else n.setDirection(rand.nextInt(4));
        }

        if (n.getDirection() == 2) {
          if (PlayerInput.checkLeft(n, s) == true) {
            n.findwalk();
            n.setX(n.getX() - npcmove);
            n.setMoveticks(n.getMoveticks() - 1);
          } else n.setDirection(rand.nextInt(4));
        }

        if (n.getDirection() == 3) {
          if (PlayerInput.checkRight(n, s) == true) {
            n.findwalk();
            n.setX(n.getX() + npcmove);
            n.setMoveticks(n.getMoveticks() - 1);
          } else n.setDirection(rand.nextInt(4));
        }
      }

      // Otherwise move towards player and fire
      else {

        if (n.calcDistance(n.getX() - npcmove, n.getGotox()) < n.getDistancex()
            && PlayerInput.checkLeft(n, s) == true) {
          n.findwalk();
          NPCFire(n, fc);
          n.setX(n.getX() - npcmove);
        }
        if (n.calcDistance(n.getX() + npcmove, n.getGotox()) < n.getDistancex()
            && PlayerInput.checkRight(n, s) == true) {

          n.findwalk();
          NPCFire(n, fc);
          n.setX(n.getX() + npcmove);
        }

        if (n.calcDistance(n.getY() + npcmove, n.getGotoy()) < n.getDistancey()
            && PlayerInput.checkUp(n, s) == true) {
          n.findwalk();
          NPCFire(n, fc);
          n.setY(n.getY() + npcmove);
        }

        if (n.calcDistance(n.getY() - npcmove, n.getGotoy()) < n.getDistancey()
            && PlayerInput.checkDown(n, s) == true) {

          n.findwalk();
          NPCFire(n, fc);
          n.setY(n.getY() - npcmove);
        }
      }
    }
  }
Example #22
0
  public void draw(Graphics2D g) {

    /*
    g.setColor(Color.WHITE);
    g.fillRect(0, 0, GamePanel.WIDTH, GamePanel.HEIGHT);
    g.setColor(Color.white);
    */
    // bgManager.draw(g);
    /*
                mAlimentos.drawAlimentos(g);
        mAlimentos.drawPoderes(g);
    */
    // draw the backgrounds
    /*
    bgSky.draw(g);
    bgSoil.draw(g);
    */
    bgKitchen.draw(g);

    // draw the rails
    /*
    g.setColor(Color.blue);
    g.fillRect(0, 484, GamePanel.WIDTH, 3);
    g.fillRect(0, 592, GamePanel.WIDTH, 3);
    g.fillRect(0, 700, GamePanel.WIDTH, 3);
    */

    // draw the dishes
    for (int i = 0; i < dishes.size(); i++) {
      dishes.get(i).draw(g);
    }

    // draw the player
    player.draw(g);

    // draw the npc
    npc.draw(g);

    // draw the hud
    hud.draw(g);

    // drawing rails
    // {444, 552, 660}

    // draw the dish values
    for (int i = 0; i < numbers.size(); i++) {
      numbers.get(i).draw(g);
    }

    // draw the explosion
    for (int i = 0; i < explosions.size(); i++) {
      explosions.get(i).draw(g);
    }

    // draw the heart bg animation
    if (player.getCholesterol() >= 85) {
      g.drawImage(
          ImagesLoader.getImage("heartattackbg"),
          GamePanel.WIDTH / 2 - ImagesLoader.getImage("heartattackbg").getWidth() / 2,
          GamePanel.HEIGHT / 2 - ImagesLoader.getImage("heartattackbg").getHeight() / 2,
          null);
      heartAttack.draw(g);
    }
    if (player.getCholesterol() <= 25) {
      warning.draw(g);
    }

    // end of heart bg animation
    // Text.drawString(g, "Testing Colesterage", 200, 400, "leishoFont", null);
    // Text.drawString(g, "Font testing", 600, 200, "leishoFont", txtAnimation);
    if (eventIntro) {
      if (titleIntroA != null) titleIntroA.draw(g);
      if (titleIntroB != null) titleIntroB.draw(g);
    }

    if (eventCaught) {
      if (titleCaught != null) titleCaught.draw(g);
    }

    if (eventClear) {
      if (titleClear != null) if (!showResults) titleClear.draw(g);
      if (showResults) {
        g.setColor(new Color(0, 0, 0, 226));
        g.fillRect(
            GamePanel.WIDTH / 2 - squarewidth / 2,
            GamePanel.HEIGHT / 2 - squareheight / 2,
            squarewidth,
            squareheight);
        if (ticksResults > 35) {
          g.setStroke(new BasicStroke(6));
          g.setColor(Color.white);
          g.drawRect(
              GamePanel.WIDTH / 2 - squarewidth / 2,
              GamePanel.HEIGHT / 2 - squareheight / 2,
              squarewidth,
              squareheight);
        }
        if (ticksResults > 40)
          Text.drawString(g, "Resultados", Text.CENTERED, 150, "leishoFont", null);
        if (ticksResults > 50)
          Text.drawString(
              g, "Puntos adquiridos: " + player.getScoreLevel(), 250, 250, "leishoFont", null);
        if (ticksResults > 55)
          Text.drawString(
              g, "Alimentos consumidos: " + player.getEatenDishes(), 250, 300, "leishoFont", null);
        if (ticksResults > 60)
          Text.drawString(
              g,
              "Ocasiones en Paro Cardiaco: " + hud.getTimesHeartAttack(),
              250,
              350,
              "leishoFont",
              null);
        if (ticksResults > 60)
          Text.drawString(
              g, "Ocasiones en Débil: " + hud.getTimesWeak(), 250, 400, "leishoFont", null);
        if (ticksResults > 65 && ticksResults < 80)
          Text.drawString(
              g, "Presiona Enter para continuar", Text.CENTERED, 500, "leishoFont", null);
      }
    }

    if (eventDead) {
      if (titleDead != null) titleDead.draw(g);
    }

    if (eventPoints) eventPoints();
  }