Package org.zachtaylor.jnodalxml

Examples of org.zachtaylor.jnodalxml.XmlNode


  public Record record() {
    return _record;
  }

  public XmlNode toXml() {
    XmlNode node = new XmlNode(XML_NODE_NAME);

    node.setAttribute("cash", _cash);
    node.setAttribute("badge", _badge);

    if (_avatar != null) {
      node.setAttribute("avatar", _avatar);
    }

    node.addChild(location.toXml());
    node.addChild(_bag.toXml());
    node.addChild(_record.toXml());
    node.addChild(_pokedex.toXml());
    node.addChild(_storage.toXml());

    XmlNode friends = new XmlNode("friends");
    if (_friends.get("friends") != null) {
      friends.setValue(_friends.get("friends").toString());
    }
    node.addChild(friends);

    XmlNode blocked = new XmlNode("blocked");
    if (_friends.get("blocked") != null) {
      blocked.setValue(_friends.get("blocked").toString());
    }
    node.addChild(blocked);

    XmlNode avatars = new XmlNode("avatars");
    avatars.setValue(_unlockedAvatars.toString());
    node.addChild(avatars);

    return node;
  }
View Full Code Here


    return result;
  }

  public XmlNode toXml() {
    XmlNode node = new XmlNode(XML_NODE_NAME);

    node.setAttribute("number", _info.getId());
    node.setAttribute("quantity", _quantity);
    node.setSelfClosing(true);

    return node;
  }
View Full Code Here

  public Iterator<Item> iterator() {
    return new BagIterator();
  }

  public XmlNode toXml() {
    XmlNode node = new XmlNode(XML_NODE_NAME);

    for (Map.Entry<Integer, Item> itemEntry : _items.entrySet()) {
      node.addChild(itemEntry.getValue().toXml());
    }

    return node;
  }
View Full Code Here

    computeMax();
    computeCur();
  }

  public XmlNode toXml() {
    XmlNode myNode = new XmlNode(XML_NODE_NAME);

    myNode.setAttribute("cur", _cur);
    myNode.setAttribute("max", _max);
    myNode.setAttribute("points", _pts);
    myNode.setAttribute("ev", _ev);
    myNode.setAttribute("iv", _iv);
    myNode.setSelfClosing(true);

    return myNode;
  }
View Full Code Here

      _data[StatType.SPEED.ordinal()].modify(1);
    }
  }

  public XmlNode toXml() {
    XmlNode node = new XmlNode(XML_NODE_NAME);

    node.setAttribute("points", _points);
    node.setAttribute("evtotal", _evTotal);

    for (StatType st : StatType.values()) {
      XmlNode child = get(st).toXml();
      child.setAttribute("type", st.toString());
      node.addChild(child);
    }

    return node;
  }
View Full Code Here

  public int count() {
    return _data.size();
  }

  public XmlNode toXml() {
    XmlNode node = new XmlNode(XML_NODE_NAME);

    List<Integer> seen = new ArrayList<Integer>(), owned = new ArrayList<Integer>();

    for (Map.Entry<Integer, PokedexStatus> pokedexEntry : _data.entrySet()) {
      if (pokedexEntry.getValue() == PokedexStatus.OWN)
        owned.add(pokedexEntry.getKey());
      else
        seen.add(pokedexEntry.getKey());
    }

    XmlNode seenNode = new XmlNode("seen");
    seenNode.setValue(seen.toString());
    node.addChild(seenNode);

    XmlNode ownedNode = new XmlNode("owned");
    ownedNode.setValue(owned.toString());
    node.addChild(ownedNode);

    return node;
  }
View Full Code Here

    if (!XML_NODE_NAME.equals(node.getName()))
      throw new XmlException("Cannot read node");

    String[] dataPieces;
    String seenData, ownedData;
    XmlNode seen = node.getChildren("seen").get(0);
    XmlNode owned = node.getChildren("owned").get(0);

    seenData = seen.getValue().replace('[', ' ').replace(']', ' ').trim();
    if (!seenData.isEmpty()) {
      dataPieces = seenData.split(",");
      for (String item : dataPieces) {
        _data.put(Integer.parseInt(item.trim()), PokedexStatus.SAW);
      }
    }

    ownedData = owned.getValue().replace('[', ' ').replace(']', ' ').trim();
    if (!ownedData.isEmpty()) {
      dataPieces = ownedData.split(",");
      for (String item : dataPieces) {
        _data.put(Integer.parseInt(item.trim()), PokedexStatus.OWN);
      }
View Full Code Here

  public void execute(Player player) throws ServiceException {
    String fileName = player.record().replaceMacros(getData());
    String filePath = JPokemonServer.scriptedbattlepath + fileName + ".jpkmn";

    XmlNode trainerData;

    try {
      trainerData = XmlParser.parse(new File(filePath)).get(0);
    }
    catch (FileNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.zachtaylor.jnodalxml.XmlNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.