示例#1
0
 public Element createNpcElement(Fight f, NumberFormat nf) {
   Element npcElement = doc.createElement(npcTag);
   npcElement.setAttribute(idTag, nf.format(f.getMobID()));
   npcElement.setAttribute(nameTag, f.getName());
   npcElement.setAttribute(guidTag, f.getGuid());
   npcElement.setAttribute(monthTag, nf.format((int) f.getStartEvent().month));
   npcElement.setAttribute(dayTag, nf.format((int) f.getStartEvent().day));
   npcElement.setAttribute(hourTag, nf.format((int) f.getStartEvent().hour));
   npcElement.setAttribute(minuteTag, nf.format((int) f.getStartEvent().minute));
   npcElement.setAttribute(secondTag, nf.format(f.getStartEvent().second));
   return npcElement;
 }
示例#2
0
  public Document makeDocument() {
    Element fightNode = doc.createElement(fightTag);
    fightNode.setAttribute(nameTag, fight.getName());
    fightNode.setAttribute(guidTag, fight.getGuid());
    addFightInfo(fightNode);

    Element victimNode = doc.createElement(victimTag);
    FightParticipant victim = fight.getVictim();
    XMLFightParticipant victimXP = new XMLFightParticipant(doc, victim, fight);
    Node victimParticipantNode = victimXP.makeNode();
    fightNode.appendChild(victimNode);
    victimNode.appendChild(victimParticipantNode);

    List<FightParticipant> parts = fight.getParticipants();
    for (FightParticipant p : parts) {
      XMLFightParticipant xp = new XMLFightParticipant(doc, p, fight);
      Node n = xp.makeNode();
      fightNode.appendChild(n);
    }
    doc.appendChild(fightNode);
    return doc;
  }
示例#3
0
  public void addFightInfo(Element e) {
    NumberFormat nf = WLPNumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);
    Element mergedElement = doc.createElement(mergedTag);
    mergedElement.setTextContent("" + fight.isMerged());
    e.appendChild(mergedElement);

    Element durationElement = doc.createElement(durationTag);
    durationElement.setTextContent(nf.format(fight.getEndTime() - fight.getStartTime()));
    e.appendChild(durationElement);

    Element activeDurationElement = doc.createElement(activeDurationTag);
    activeDurationElement.setTextContent(nf.format(fight.getActiveDuration()));
    e.appendChild(activeDurationElement);

    Element numMobsElement = doc.createElement(numMobsTag);
    if (fight.isMerged()) {
      numMobsElement.setTextContent(nf.format(fight.getMergedSourceFights().size()));
      Element npcsElement = doc.createElement(npcsTag);
      e.appendChild(npcsElement);
      List<Fight> sourceFights = fight.getMergedSourceFights();
      for (Fight f : sourceFights) {
        Element npcElement = createNpcElement(f, nf);
        npcsElement.appendChild(npcElement);
      }
    } else {
      numMobsElement.setTextContent(nf.format(1));
      Element npcsElement = doc.createElement(npcsTag);
      e.appendChild(npcsElement);
      Element npcElement = createNpcElement(fight, nf);
      npcsElement.appendChild(npcElement);
    }
    e.appendChild(numMobsElement);

    Element totalDamageElement = doc.createElement(totalDamageTag);
    Element totalHealingElement = doc.createElement(totalHealingTag);
    long damage = 0;
    long healing = 0;
    for (FightParticipant p : fight.getParticipants()) {
      AmountAndCount a = p.totalDamage(Constants.SCHOOL_ALL, FightParticipant.TYPE_ALL_DAMAGE);
      damage += a.amount;
      a = p.totalHealing(Constants.SCHOOL_ALL, FightParticipant.TYPE_ALL_HEALING);
      healing += a.amount;
    }
    totalDamageElement.setTextContent(nf.format(damage));
    e.appendChild(totalDamageElement);
    totalHealingElement.setTextContent(nf.format(healing));
    e.appendChild(totalHealingElement);

    Element dispellInfoElement = doc.createElement(dispellInfoTag);
    DispellEvents de = new DispellEvents(fight.getEvents());
    int numNames = de.getNumNames();
    for (int k = 0; k < numNames; k++) {
      String auraName = de.getName(k);
      Element auraElement = doc.createElement(auraDispelledTag);
      auraElement.setAttribute(nameTag, auraName);
      List<SpellAuraDispelledEvent> events = de.getEvents(auraName);
      for (SpellAuraDispelledEvent ev : events) {
        Element eventElement = doc.createElement(dispEventTag);
        ev.addXmlAttributes(eventElement);
        //                eventElement.setAttribute(sourceTag, ev.sourceName);
        //                eventElement.setAttribute(sourceGuidTag, ev.sourceGUID);
        //                eventElement.setAttribute(skillTag, ev.getName());
        //                eventElement.setAttribute(targetTag, ev.destinationName);
        //                eventElement.setAttribute(destinationGuidTag, ev.destinationGUID);
        //                eventElement.setAttribute(timeTag, ev.getTimeStringExact());
        auraElement.appendChild(eventElement);
      }
      dispellInfoElement.appendChild(auraElement);
    }
    e.appendChild(dispellInfoElement);

    Element interruptInfoElement = doc.createElement(interruptInfoTag);
    InterruptEvents ie = new InterruptEvents(fight.getEvents());
    numNames = ie.getNumNames();
    for (int k = 0; k < numNames; k++) {
      String spellName = ie.getName(k);
      Element spellElement = doc.createElement(spellInterruptedTag);
      spellElement.setAttribute(nameTag, spellName);
      List<SpellInterruptEvent> events = ie.getEvents(spellName);
      for (SpellInterruptEvent ev : events) {
        Element eventElement = doc.createElement(intEventTag);
        ev.addXmlAttributes(eventElement);
        //                eventElement.setAttribute(sourceTag, ev.sourceName);
        //                eventElement.setAttribute(skillTag, ev.getName());
        //                eventElement.setAttribute(targetTag, ev.destinationName);
        //                eventElement.setAttribute(timeTag, ev.getTimeStringExact());
        spellElement.appendChild(eventElement);
      }
      interruptInfoElement.appendChild(spellElement);
    }
    e.appendChild(interruptInfoElement);
  }