/**
   * Appends an appearance update.
   *
   * @param packet The packet.
   * @param otherPlayer The player.
   */
  private void appendPlayerAppearanceUpdate(PacketBuilder packet, Player otherPlayer) {
    Appearance app = otherPlayer.getAppearance();
    Container eq = otherPlayer.getEquipment();

    PacketBuilder playerProps = new PacketBuilder();
    playerProps.put((byte) app.getGender()); // gender
    if ((app.getGender() & 0x2) == 2) {
      playerProps.put((byte) 0);
      playerProps.put((byte) 0);
    }
    playerProps.put((byte) -1); // skull icon
    playerProps.put((byte) -1); // prayer icon

    if (!otherPlayer.getAppearance().isNpc()) {
      for (int i = 0; i < 4; i++) {
        if (eq.isSlotUsed(i)) {
          playerProps.putShort((short) 32768 + eq.get(i).getDefinition().getEquipId());
        } else {
          playerProps.put((byte) 0);
        }
      }
      if (eq.isSlotUsed(Equipment.SLOT_CHEST)) {
        playerProps.putShort(
            (short) 32768 + eq.get(Equipment.SLOT_CHEST).getDefinition().getEquipId());
      } else {
        playerProps.putShort((short) 0x100 + app.getChest()); // chest
      }
      if (eq.isSlotUsed(Equipment.SLOT_SHIELD)) {
        playerProps.putShort(
            (short) 32768 + eq.get(Equipment.SLOT_SHIELD).getDefinition().getEquipId());
      } else {
        playerProps.put((byte) 0);
      }
      final Item chest = eq.get(Equipment.SLOT_CHEST);
      if (chest != null) {
        if (!Equipment.is(EquipmentType.PLATEBODY, chest)) {
          playerProps.putShort((short) 0x100 + app.getArms());
        } else {
          playerProps.putShort((short) 32768 + chest.getDefinition().getEquipId());
        }
      } else {
        playerProps.putShort((short) 0x100 + app.getArms());
      }
      if (eq.isSlotUsed(Equipment.SLOT_BOTTOMS)) {
        playerProps.putShort(
            (short) 32768 + eq.get(Equipment.SLOT_BOTTOMS).getDefinition().getEquipId());
      } else {
        playerProps.putShort((short) 0x100 + app.getLegs());
      }
      final Item helm = eq.get(Equipment.SLOT_HELM);
      if (helm != null) {
        if (!Equipment.is(EquipmentType.FULL_HELM, helm)
            && !Equipment.is(EquipmentType.FULL_MASK, helm)) {
          playerProps.putShort((short) 0x100 + app.getHead());
        } else {
          playerProps.put((byte) 0);
        }
      } else {
        playerProps.putShort((short) 0x100 + app.getHead());
      }
      if (eq.isSlotUsed(Equipment.SLOT_GLOVES)) {
        playerProps.putShort(
            (short) 32768 + eq.get(Equipment.SLOT_GLOVES).getDefinition().getEquipId());
      } else {
        playerProps.putShort((short) 0x100 + app.getHands());
      }
      if (eq.isSlotUsed(Equipment.SLOT_BOOTS)) {
        playerProps.putShort(
            (short) 32768 + eq.get(Equipment.SLOT_BOOTS).getDefinition().getEquipId());
      } else {
        playerProps.putShort((short) 0x100 + app.getFeet());
      }
      boolean fullHelm = false;
      if (helm != null) {
        fullHelm = !Equipment.is(EquipmentType.FULL_HELM, helm);
      }
      if (fullHelm || app.getGender() == 1) {
        playerProps.put((byte) 0);
      } else {
        playerProps.putShort((short) 0x100 + app.getBeard());
      }
    } else {
      playerProps.putShort(-1);
      playerProps.putShort(otherPlayer.getAppearance().getNpcIndex());
    }

    playerProps.put((byte) app.getHairColour()); // hairc
    playerProps.put((byte) app.getTorsoColour()); // torsoc
    playerProps.put((byte) app.getLegColour()); // legc
    playerProps.put((byte) app.getFeetColour()); // feetc
    playerProps.put((byte) app.getSkinColour()); // skinc

    Item weapon = eq.get(Equipment.SLOT_WEAPON);

    playerProps.putShort((short) Equipment.standAnimation(weapon)); // stand
    playerProps.putShort((short) 0x337); // stand turn
    playerProps.putShort((short) Equipment.walkAnimation(weapon)); // walk
    playerProps.putShort((short) 0x334); // turn 180
    playerProps.putShort((short) 0x335); // turn 90 cw
    playerProps.putShort((short) 0x336); // turn 90 ccw
    playerProps.putShort((short) Equipment.runAnimation(weapon)); // run

    playerProps.putLong(otherPlayer.getNameAsLong()); // player name
    playerProps.put((byte) otherPlayer.getSkills().getCombatLevel()); // combat level
    playerProps.putShort(
        0); // (skill-level instead of combat-level) otherPlayer.getSkills().getTotalLevel()); //
            // total level
    Packet propsPacket = playerProps.toPacket();
    packet.put((byte) (propsPacket.getLength() & 0xff));
    packet.putBytes(propsPacket.getPayload(), 0, propsPacket.getLength());
  }