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

      // if needs to get money
      if (obj.getChild("Money") != null) {
        quest.setMoneyNeeded(Integer.parseInt(obj.getChildText("Money")));
      }

      // if needs itens
      if (obj.getChild("Itens") != null) {
        // get the Itens
        Object[] objects;
        objects = loadTwoDependencies(obj.getChild("Itens"));
        // set their places
        quest.setGetItem((String[]) objects[0]);
        quest.setNumberItemGot((int[]) objects[1]);
      }

      // if needs monsters kills
      if (obj.getChild("Monsters") != null) {
        // get the Itens
        Object[] objects;
        objects = loadTwoDependencies(obj.getChild("Monsters"));
        // set their places
        quest.setMonsterKill((String[]) objects[0]);
        quest.setMonsterKilled((int[]) objects[1]);
      }

      // if needs talk to
      if (obj.getChild("Talk") != null) {
        // get the order
        quest.setOrder(Boolean.parseBoolean(obj.getChildText("Order")));
        // get the NPCs
        quest.setNPCTalk(loadOneDependencie(obj.getChild("Talk").getChild("NPC")));
        // create the controller for this
        quest.createNPCTalkControl();
      }
    }
  }