Example #1
0
  public void createReward(Element rew, Quest quest) {
    if (rew != null) {

      // if there´s money to be rewarded
      if (rew.getChild("Money") != null) {
        quest.setMoneyRewarded(Integer.parseInt(rew.getChildText("Money")));
      } else {
        // if there´s no money reward
        quest.setMoneyRewarded(-1);
      }

      // if there´s one or more itens to be rewarded
      if (rew.getChild("Itens") != null) {
        // get the Itens
        Object[] objects;
        objects = loadTwoDependencies(rew.getChild("Itens"));
        // set their places
        quest.setRewardItem((String[]) objects[0]);
        quest.setRewardedItem((int[]) objects[1]);
      }

      // if there´s something of the character that increases
      if (rew.getChild("Features") != null) {
        // get the Itens
        Object[] objects;
        objects = loadThreeDependencies(rew.getChild("Features"));
        // set their places
        quest.setFeatureName((String[]) objects[0]);
        quest.setFeatureType((String[]) objects[1]);
        quest.setFeatureValue((int[]) objects[2]);
      }
    }
  }