示例#1
0
  /**
   * Write a given stage of the full NPC data.
   *
   * @param source the parsed NPC that is the data source
   * @param target the writer that is the target
   * @param stage the current stage that is supposed to be processed
   * @throws IOException thrown in case the writing operations fail
   */
  private void writeStage(final ParsedNpc source, final Writer target, final WritingStage stage)
      throws IOException {
    final int count = source.getDataCount();

    EasyNpcWritable writeable = null;
    for (int i = 0; i < count; ++i) {
      writeable = source.getEasyNpcData(i);
      writeable.writeEasyNpc(target, stage);
    }
  }
示例#2
0
  /**
   * Check if there are any entries in this stage.
   *
   * @param source the NPC that is the data source
   * @param stage the stage to check
   * @return <code>true</code> in case the NPC contains entries in this stage.
   */
  private boolean checkStageExists(final ParsedNpc source, final WritingStage stage) {
    final int count = source.getDataCount();

    EasyNpcWritable writeable = null;
    for (int i = 0; i < count; ++i) {
      writeable = source.getEasyNpcData(i);
      if (writeable.effectsEasyNpcStage(stage)) {
        return true;
      }
    }

    return false;
  }