Package rra.model

Examples of rra.model.Combat


  public List<Combat> getCombatList() {
    return this.data.getCombatList();
  }
 
  public Combat getCombat(String name) {
    return (Combat)CollectionUtils.find(this.data.getCombatList(), new RRAPredicate(new Combat(0,name,null)));   
  }
View Full Code Here


 
  public boolean parse(String s,boolean disposeSmall,int disposeActions,boolean pruneHealing) {
    if(s.contains("Combat Begin")) this.combatSpecialFlag=true;
    if(s.contains("Combat End")) this.combatSpecialFlag=false;
   
    Combat com1=this.data.getLastCombat();
   
    long tstamp=0;
    Date comStart=null;
    Matcher m1=p1.matcher(s);
    if(m1.find()) {
      String ts1=m1.group();
      if(ts1.length()>0) {
        try {
          comStart=sdf.parse(ts1);
          c.setTime(comStart);
          int hour=c.get(Calendar.HOUR_OF_DAY);
          int minute=c.get(Calendar.MINUTE);
          int second=c.get(Calendar.SECOND);
          tstamp=hour*3600+minute*60+second;
        } catch (ParseException e) {
          e.printStackTrace();
        }
      }
    }
    if(tstamp==0) {
      //System.out.println("Parser error: timestamp cannot be determined for ("+s+")");
      return false;
    }
   
    Matcher m2=p2.matcher(s);
    if(!m2.find()) {
      //System.out.println("Parser error: no main brackets for ("+s+")");
      return false;
    }
    String s1=m2.group();
    if(s1.length()<2) {
      //System.out.println("Parser error: main content too short ("+s1+")");
      return false;
    }
    String s2=s1.substring(1, s1.length()-2);
    String[] values=s2.split(",");
   
    for(int i1=0;i1<values.length;i1++)
      values[i1]=values[i1].trim();
   
    List<RRAParserMitigation> mitigations=new ArrayList<RRAParserMitigation>();
    Matcher m5=p5.matcher(s);
    if(m5.find()) {
      String s3=m5.group();
      Matcher m6=p6.matcher(s3);
      while(m6.find()) {
        String s4=m6.group();
       
        Matcher m3=p3.matcher(s4);
        Matcher m4=p4.matcher(s4);
        if(m3.find() && m4.find()) {
          RRAParserMitigation mit=new RRAParserMitigation();
          try {
            mit.setDamageMitigated(Long.parseLong(m3.group()));
          } catch (NumberFormatException e) {
            e.printStackTrace();
          }
          mit.setMitigation(m4.group().trim());
          mitigations.add(mit);
        }
      }
     
    }
   
    String damageType="Physical";
    if(s.contains("Death")) damageType="Death";
    else if(s.contains("Air")) damageType="Air";
    else if(s.contains("Water")) damageType="Water";
    else if(s.contains("Fire")) damageType="Air";
    else if(s.contains("Life")) damageType="Life";
    else if(s.contains("Earth")) damageType="Earth";
   
    // Types
    /*
     * 1 - Begin cast
     * 2 - Interrupt
     * 3 - Damage
     * 4 - DoT damage
     * 5 - Heal
     * 6 - Ability gain
     * 7 - Ability fade
     * 8 - Aura affliction
     * 9 - Aura dissipation
     * 10 - Miss
     * 11 - Slain (death)
     * 12 - Death (general)
     * 14 - Damage take (unknown causer)
     * 15 - Dodge
     * 16 - Parry
     * 19 - Resist
     * 23 - Critical damage
     * 26 - Immune
     * 27 - Resource gain
     * 28 - Critical heal
     */
   
    // If we have damage type and last combat doesn't exist or is done, we need new combat
    if(values[0].equals(RRAParser.EventDamage) ||
        values[0].equals(RRAParser.EventDoTDamage) ||
        values[0].equals(RRAParser.EventCritDamage) ||
        (this.combatSpecialFlag && values[0].equals(RRAParser.EventHeal)) ||
        (this.combatSpecialFlag && values[0].equals(RRAParser.EventCritHeal)) ||
        values[0].equals(RRAParser.EventDamageTake)) {
      if(com1==null || !com1.isActive()) {
        com1=data.addNewCombat();
        com1.startCombat(comStart,tstamp);
      }
    }
   
    if(com1==null) return false;
   
    if(com1.isActive()) {
      if(com1.getName().contains("Trash")) {
        if(RRAUtils.checkIfParticipantIsKnownEnemy(values[5])!=null)
          com1.setSpecialName(RRAUtils.checkIfParticipantIsKnownEnemy(values[5]));
      }
      if(com1.getName().contains("Trash")) {
        if(RRAUtils.checkIfParticipantIsKnownEnemy(values[6])!=null)
          com1.setSpecialName(RRAUtils.checkIfParticipantIsKnownEnemy(values[6]));
      }
      com1.setCombatDuration(tstamp);
    }
   
    if(values[0].equals(RRAParser.EventDamage) || values[0].equals(RRAParser.EventDoTDamage)) {
      long damage=Long.parseLong(values[7]);
      try {
        com1.addDamageEvent(tstamp, values[5], values[6], damage, values[9], DPSStats.OutcomeHit, damageType);
        for(Iterator<RRAParserMitigation> m=mitigations.iterator();m.hasNext();) {
          RRAParserMitigation mit=m.next();
          if(mit.getMitigation().equalsIgnoreCase("blocked"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeBlock, damageType);
          if(mit.getMitigation().equalsIgnoreCase("absorbed"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeAbsorbed, damageType);
          if(mit.getMitigation().equalsIgnoreCase("intercepted"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeIntercepted, damageType);
        }
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventCritDamage)) {
      long damage=Long.parseLong(values[7]);
      try {
        com1.addDamageEvent(tstamp, values[5], values[6], damage, values[9], DPSStats.OutcomeCrit, damageType);
        for(Iterator<RRAParserMitigation> m=mitigations.iterator();m.hasNext();) {
          RRAParserMitigation mit=m.next();
          if(mit.getMitigation().equalsIgnoreCase("blocked"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeBlock, damageType);
          if(mit.getMitigation().equalsIgnoreCase("absorbed"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeAbsorbed, damageType);
          if(mit.getMitigation().equalsIgnoreCase("intercepted"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeIntercepted, damageType);
        }
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }

    if(values[0].equals(RRAParser.EventMiss)) {
      try {
        com1.addDamageEvent(tstamp, values[5], values[6], 0, values[9], DPSStats.OutcomeMiss, damageType);
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventDodge)) {
      try {
        com1.addDamageEvent(tstamp, values[5], values[6], 0, values[9], DPSStats.OutcomeDodge, damageType);
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventParry)) {
      try {
        com1.addDamageEvent(tstamp, values[5], values[6], 0, values[9], DPSStats.OutcomeParry, damageType);
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventResist)) {
      try {
        com1.addDamageEvent(tstamp, values[5], values[6], 0, values[9], DPSStats.OutcomeResist, damageType);
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventHeal) || values[0].equals(RRAParser.EventCritHeal)) {
      long heal=Long.parseLong(values[7]);
      long overheal=0;
      try {
        for(Iterator<RRAParserMitigation> m=mitigations.iterator();m.hasNext();) {
          RRAParserMitigation mit=m.next();
          if(mit.getMitigation().equalsIgnoreCase("overheal")) overheal=mit.getDamageMitigated();
        }
        com1.addHealingEvent(tstamp, values[5], values[6], heal, values[9], overheal, (values[0].equals(RRAParser.EventCritHeal)));
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }

    if(values[0].equals(RRAParser.EventSlain)) {
      try {
        com1.addDeath(tstamp, values[6], values[5]);
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventDeath)) {
      try {
        com1.addDeath(tstamp, values[5], "Unknown");
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(values[0].equals(RRAParser.EventInterrupt)) {
      try {
        com1.addInterrupt(tstamp, values[5], values[9]);
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }

    if(values[0].equals(RRAParser.EventDamageTake)) {
      long damage=Long.parseLong(values[7]);
      try {
        com1.addDamageTakenEvent(tstamp, values[5], values[6], damage, values[9], DPSStats.OutcomeHit, damageType);
        for(Iterator<RRAParserMitigation> m=mitigations.iterator();m.hasNext();) {
          RRAParserMitigation mit=m.next();
          if(mit.getMitigation().equalsIgnoreCase("blocked"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeBlock, damageType);
          if(mit.getMitigation().equalsIgnoreCase("absorbed"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeAbsorbed, damageType);
          if(mit.getMitigation().equalsIgnoreCase("intercepted"))
            com1.addDamageEvent(tstamp, values[5], values[6], mit.getDamageMitigated(), values[9], DPSStats.OutcomeIntercepted, damageType);
        }
      } catch (RRAException e) {
        //e.printStackTrace();
      }
    }
   
    if(com1.tryToCloseCombat(tstamp, pruneHealing)) {
      if(disposeSmall && disposeActions>0 && com1.getCombatActions()<=disposeActions) {
        this.data.getCombatList().remove(com1);
        return false;
      } else return true;
    } else return false;
  }
View Full Code Here

      try {
        SwingUtilities.invokeAndWait(new Runnable() {
          @Override
          public void run() {
            for(Iterator<Combat> it=tmp.iterator();it.hasNext();) {
              Combat c=it.next();
              if(!c.isActive()) {
                ((DefaultListModel)cList.getModel()).addElement(c.getName());
                parser.getData().addCombatToAllStats(c);
              }
            }
          }
        });
      } catch (Exception e) {
        e.printStackTrace();
      }
      cList.revalidate();
      cList.repaint();
     
      DefaultTableModel dtm=new DefaultTableModel();
      allDPSO.setModel(dtm);
      dtm.addColumn("Participant");
      dtm.addColumn("Combats");
      dtm.addColumn("Duration of all combats");
      dtm.addColumn("Damage done");
      dtm.addColumn("DPS");
      for(Iterator<Participant> it=parser.getData().getDPSSortedParticipantList().iterator();it.hasNext();) {
        Participant p=it.next();
        dtm.addRow(new Object[]{p.getName(),p.getCombats(),p.getCombatDuration(),p.getDamageDone(),p.getDPS()});
      }
      dtm.fireTableDataChanged();
      allDPSO.revalidate();
      allDPSO.repaint();
     
      dtm=new DefaultTableModel();
      allHPS.setModel(dtm);
      dtm.addColumn("Participant");
      dtm.addColumn("Combats");
      dtm.addColumn("Duration of all combats");
      dtm.addColumn("Healing done");
      dtm.addColumn("HPS");
      for(Iterator<Participant> it=parser.getData().getHPSSortedParticipantList().iterator();it.hasNext();) {
        Participant p=it.next();
        dtm.addRow(new Object[]{p.getName(),p.getCombats(),p.getCombatDuration(),p.getHealingDone(),p.getHPS()});
      }
      dtm.fireTableDataChanged();
      allHPS.revalidate();
      allHPS.repaint();
     
      dtm=new DefaultTableModel();
      allDPST.setModel(dtm);
      dtm.addColumn("Participant");
      dtm.addColumn("Combats");
      dtm.addColumn("Duration of all combats");
      dtm.addColumn("Damage taken");
      dtm.addColumn("DTPS");
      for(Iterator<Participant> it=parser.getData().getDTPSSortedParticipantList().iterator();it.hasNext();) {
        Participant p=it.next();
        dtm.addRow(new Object[]{p.getName(),p.getCombats(),p.getCombatDuration(),p.getDamageTaken(),p.getDTPS()});
      }
      dtm.fireTableDataChanged();
      allDPST.revalidate();
      allDPST.repaint();
    }
    if(eventType==RRAMediator.EventNewFile || eventType==EventCombatDeselected) {
      if(eventType==RRAMediator.EventNewFile) {
        ((DefaultListModel)cList.getModel()).removeAllElements();
        cList.revalidate();
        cList.repaint();

        parser.getData().clearCombatAllStats();
        allDPSO.setModel(new DefaultTableModel());
        allDPSO.revalidate();
        allDPSO.repaint();
        allHPS.setModel(new DefaultTableModel());
        allHPS.revalidate();
        allHPS.repaint();
        allDPST.setModel(new DefaultTableModel());
        allDPST.revalidate();
        allDPST.repaint();
      }
      combatName.setText("");
      combatStart.setText("");
      combatEnd.setText("");
      combatDuration.setText("");
      dpso.setModel(new DefaultTableModel());
      dpso.revalidate();
      dpso.repaint();
      dpsoPanel.removeAll();
      dpsoPanel.revalidate();
      dpsoPanel.repaint();
      hps.setModel(new DefaultTableModel());
      hps.revalidate();
      hps.repaint();
      hpsPanel.removeAll();
      hpsPanel.revalidate();
      hpsPanel.repaint();
      dpst.setModel(new DefaultTableModel());
      dpst.revalidate();
      dpst.repaint();
      dpstPanel.removeAll();
      dpstPanel.revalidate();
      dpstPanel.repaint();
      ((DefaultListModel)cParticipants.getModel()).removeAllElements();
      cParticipants.revalidate();
      cParticipants.repaint();
      x1_dps1Stats.setModel(new DefaultTableModel());
      x1_dps1Stats.revalidate();
      x1_dps1Stats.repaint();
      x1_dps2Stats.setModel(new DefaultTableModel());
      x1_dps2Stats.revalidate();
      x1_dps2Stats.repaint();
      x1_dtps1Stats.setModel(new DefaultTableModel());
      x1_dtps1Stats.revalidate();
      x1_dtps1Stats.repaint();
      x1_dtps2Stats.setModel(new DefaultTableModel());
      x1_dtps2Stats.revalidate();
      x1_dtps2Stats.repaint();
      x1_hps1Stats.setModel(new DefaultTableModel());
      x1_hps1Stats.revalidate();
      x1_hps1Stats.repaint();
      x1_hps2Stats.setModel(new DefaultTableModel());
      x1_hps2Stats.revalidate();
      x1_hps2Stats.repaint();
      x1_hps3Stats.setModel(new DefaultTableModel());
      x1_hps3Stats.revalidate();
      x1_hps3Stats.repaint();
      x1_dtpsTypes.setModel(new DefaultTableModel());
      x1_dtpsTypes.revalidate();
      x1_dtpsTypes.repaint();
      interrupts.setModel(new DefaultTableModel());
      interrupts.revalidate();
      interrupts.repaint();
      deaths.setModel(new DefaultTableModel());
      deaths.revalidate();
      deaths.repaint();
    }
    if(eventType==RRAMediator.EventCombatChanged) {     
      DefaultTableModel dtm=new DefaultTableModel();
      dpso.setModel(dtm);
      dtm.addColumn("");
      dtm.addColumn("Combat participant");
      dtm.addColumn("Damage done");
      dtm.addColumn("DPS");
      dtm.addColumn("DPSe");
      dtm.addColumn("Activity");
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      if(c==null) return;
      int marked=3;
      XYSeriesCollection dps_dataset=new XYSeriesCollection();
      for(Iterator<CombatParticipant> it=c.getSortedDPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        ((DefaultListModel)cParticipants.getModel()).addElement(cp.getName());
        dtm.addRow(new Object[]{(marked>0),cp.getName(),cp.getDpsRealTimeStats().getDamage(),cp.getDpsRealTimeStats().getDPS(c.getCombatDuration()),cp.getDpsRealTimeStats().getDPSe(),cp.getDpsRealTimeStats().getActivity(c.getCombatDuration())});
        if(marked>0)
          dps_dataset.addSeries(createDPSSeries(c,cp));
        marked--;
      }
      dpsoChart=ChartFactory.createXYLineChart("Real time DPS", "Seconds of combat", "DPS", dps_dataset, PlotOrientation.VERTICAL, true, true, false);
      dpsoChart.getXYPlot().setRenderer(new XYSplineRenderer());
      dpsoChartPanel=new ChartPanel(dpsoChart);
      dpsoChartPanel.setLayout(new BorderLayout());
      dpsoPanel.removeAll();
      dpsoPanel.add(dpsoChartPanel);
      dpsoChartPanel.revalidate();
      dpsoChartPanel.repaint();
      dpso.getColumnModel().getColumn(0).setMaxWidth(30);
      dpso.getColumnModel().getColumn(0).setCellRenderer(new CheckBoxCellRenderer());
      dpso.getColumnModel().getColumn(0).setCellEditor(new DPSCheckBoxCellEditor(c.getName(),this));
      dtm.fireTableDataChanged();
      dpso.revalidate();
      dpso.repaint();
     
      combatName.setText(c.getName());
      SimpleDateFormat sdf=new SimpleDateFormat("HH:mm:ss");
      combatStart.setText(sdf.format(c.getCombatStart()));
      combatEnd.setText(sdf.format(c.getCombatEnd()));
      combatDuration.setText(Long.toString(c.getCombatDuration()));
     
      ((DefaultListModel)cParticipants.getModel()).removeAllElements();
      for(Iterator<CombatParticipant> it=c.getSortedParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        ((DefaultListModel)cParticipants.getModel()).addElement(cp.getName());
      }
      x1_dps1Stats.setModel(new DefaultTableModel());
      x1_dps1Stats.revalidate();
      x1_dps1Stats.repaint();
      x1_dps2Stats.setModel(new DefaultTableModel());
      x1_dps2Stats.revalidate();
      x1_dps2Stats.repaint();
      x1_dtps1Stats.setModel(new DefaultTableModel());
      x1_dtps1Stats.revalidate();
      x1_dtps1Stats.repaint();
      x1_dtps2Stats.setModel(new DefaultTableModel());
      x1_dtps2Stats.revalidate();
      x1_dtps2Stats.repaint();
      x1_hps1Stats.setModel(new DefaultTableModel());
      x1_hps1Stats.revalidate();
      x1_hps1Stats.repaint();
      x1_hps2Stats.setModel(new DefaultTableModel());
      x1_hps2Stats.revalidate();
      x1_hps2Stats.repaint();
      x1_hps3Stats.setModel(new DefaultTableModel());
      x1_hps3Stats.revalidate();
      x1_hps3Stats.repaint();
      x1_dtpsTypes.setModel(new DefaultTableModel());
      x1_dtpsTypes.revalidate();
      x1_dtpsTypes.repaint();
      interrupts.setModel(new DefaultTableModel());
      interrupts.revalidate();
      interrupts.repaint();
      deaths.setModel(new DefaultTableModel());
      deaths.revalidate();
      deaths.repaint();
      cParticipants.revalidate();
      cParticipants.repaint();     

      DefaultTableModel htm=new DefaultTableModel();
      hps.setModel(htm);
      htm.addColumn("");
      htm.addColumn("Combat participant");
      htm.addColumn("Healing done");
      htm.addColumn("Overhealing");
      htm.addColumn("HPS");
      htm.addColumn("HPSe");
      htm.addColumn("Activity");
      marked=3;
      XYSeriesCollection hps_dataset=new XYSeriesCollection();
      for(Iterator<CombatParticipant> it=c.getSortedHPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        htm.addRow(new Object[]{(marked>0),cp.getName(),cp.getHpsRealTimeStats().getHealingDone(),cp.getHpsRealTimeStats().getOverhealingDone(),cp.getHpsRealTimeStats().getHPS(c.getCombatDuration()),cp.getHpsRealTimeStats().getHPSe(),cp.getHpsRealTimeStats().getActivity(c.getCombatDuration())});
        if(marked>0)
          hps_dataset.addSeries(createHPSSeries(c,cp));
        marked--;
      }
      hpsChart=ChartFactory.createXYLineChart("Real time HPS", "Seconds of combat", "HPS", hps_dataset, PlotOrientation.VERTICAL, true, true, false);
      hpsChart.getXYPlot().setRenderer(new XYSplineRenderer());
      hpsChartPanel=new ChartPanel(hpsChart);
      hpsChartPanel.setLayout(new BorderLayout());
      hpsPanel.removeAll();
      hpsPanel.add(hpsChartPanel);
      hpsChartPanel.revalidate();
      hpsChartPanel.repaint();
      hps.getColumnModel().getColumn(0).setMaxWidth(30);
      hps.getColumnModel().getColumn(0).setCellRenderer(new CheckBoxCellRenderer());
      hps.getColumnModel().getColumn(0).setCellEditor(new HPSCheckBoxCellEditor(c.getName(),this));
      htm.fireTableDataChanged();
      hps.revalidate();
      hps.repaint();
     
      DefaultTableModel dttm=new DefaultTableModel();
      dpst.setModel(dttm);
      dttm.addColumn("");
      dttm.addColumn("Combat participant");
      dttm.addColumn("Damage taken");
      dttm.addColumn("DTPS");
      dttm.addColumn("DTPSe");
      dttm.addColumn("Activity");
      marked=3;
      XYSeriesCollection dtps_dataset=new XYSeriesCollection();
      for(Iterator<CombatParticipant> it=c.getSortedDTPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        dttm.addRow(new Object[]{(marked>0),cp.getName(),cp.getDtpsRealTimeStats().getDamage(),cp.getDtpsRealTimeStats().getDPS(c.getCombatDuration()),cp.getDtpsRealTimeStats().getDPSe(),cp.getDtpsRealTimeStats().getActivity(c.getCombatDuration())});
        if(marked>0)
          dtps_dataset.addSeries(createDTPSSeries(c,cp));
        marked--;
      }
      dpstChart=ChartFactory.createXYLineChart("Real time damage taken", "Seconds of combat", "DTPS", dtps_dataset, PlotOrientation.VERTICAL, true, true, false);
      dpstChart.getXYPlot().setRenderer(new XYSplineRenderer());
      dpstChartPanel=new ChartPanel(dpstChart);
      dpstChartPanel.setLayout(new BorderLayout());
      dpstPanel.removeAll();
      dpstPanel.add(dpstChartPanel);
      dpstChartPanel.revalidate();
      dpstChartPanel.repaint();
      dpst.getColumnModel().getColumn(0).setMaxWidth(30);
      dpst.getColumnModel().getColumn(0).setCellRenderer(new CheckBoxCellRenderer());
      dpst.getColumnModel().getColumn(0).setCellEditor(new DTPSCheckBoxCellEditor(c.getName(),this));
      dttm.fireTableDataChanged();
      dpst.revalidate();
      dpst.repaint();
    }
    if(eventType==RRAMediator.EventDPSCombatParticipantChange) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedDPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          boolean select=((Boolean)parameters.toArray()[2]).booleanValue();
          XYSeriesCollection dataset=(XYSeriesCollection)dpsoChart.getXYPlot().getDataset();
          boolean exists=false;
          for(Iterator<XYSeries> it2=dataset.getSeries().iterator();it2.hasNext() && !exists;) {
            XYSeries xys=it2.next();
            if(xys.getKey().equals(cp.getName())) exists=true;
            if(!select && xys.getKey().equals(cp.getName())) {
              dataset.removeSeries(xys);
            }
          }         
          if(!exists && select) {
            dataset.addSeries(createDPSSeries(c,cp));
          }
        }
      }
      dpsoChart.fireChartChanged();
      dpsoChartPanel.revalidate();
      dpsoChartPanel.repaint();
    }
    if(eventType==RRAMediator.EventHPSCombatParticipantChange) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedHPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          boolean select=((Boolean)parameters.toArray()[2]).booleanValue();
          XYSeriesCollection dataset=(XYSeriesCollection)hpsChart.getXYPlot().getDataset();
          boolean exists=false;
          for(Iterator<XYSeries> it2=dataset.getSeries().iterator();it2.hasNext() && !exists;) {
            XYSeries xys=it2.next();
            if(xys.getKey().equals(cp.getName())) exists=true;
            if(!select && xys.getKey().equals(cp.getName())) {
              dataset.removeSeries(xys);
            }
          }         
          if(!exists && select) {
            dataset.addSeries(createHPSSeries(c,cp));
          }
        }
      }
      hpsChart.fireChartChanged();
      hpsChartPanel.revalidate();
      hpsChartPanel.repaint();
    }
    if(eventType==RRAMediator.EventDTPSCombatParticipantChange) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedDTPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          boolean select=((Boolean)parameters.toArray()[2]).booleanValue();
          XYSeriesCollection dataset=(XYSeriesCollection)dpstChart.getXYPlot().getDataset();
          boolean exists=false;
          for(Iterator<XYSeries> it2=dataset.getSeries().iterator();it2.hasNext() && !exists;) {
            XYSeries xys=it2.next();
            if(xys.getKey().equals(cp.getName())) exists=true;
            if(!select && xys.getKey().equals(cp.getName())) {
              dataset.removeSeries(xys);
            }
          }         
          if(!exists && select) {
            dataset.addSeries(createDTPSSeries(c,cp));
          }
        }
      }
      dpstChart.fireChartChanged();
      dpstChartPanel.revalidate();
      dpstChartPanel.repaint();
    }
    if(eventType==RRAMediator.EventNewCombat) {
      this.tmp=parameters;
      try {
        final Combat c=(Combat)tmp.toArray()[0];
        parser.getData().addCombatToAllStats(c);
        SwingUtilities.invokeAndWait(new Runnable() {
          @Override
          public void run() {
            ((DefaultListModel)cList.getModel()).addElement(c.getName());
          }
        });
      } catch (Exception e) {
        e.printStackTrace();
      }
      cList.revalidate();
      cList.repaint();

      DefaultTableModel dtm=new DefaultTableModel();
      allDPSO.setModel(dtm);
      dtm.addColumn("Participant");
      dtm.addColumn("Combats");
      dtm.addColumn("Duration of all combats");
      dtm.addColumn("Damage done");
      dtm.addColumn("DPS");
      for(Iterator<Participant> it=parser.getData().getDPSSortedParticipantList().iterator();it.hasNext();) {
        Participant p=it.next();
        dtm.addRow(new Object[]{p.getName(),p.getCombats(),p.getCombatDuration(),p.getDamageDone(),p.getDPS()});
      }
      dtm.fireTableDataChanged();
      allDPSO.revalidate();
      allDPSO.repaint();
     
      dtm=new DefaultTableModel();
      allHPS.setModel(dtm);
      dtm.addColumn("Participant");
      dtm.addColumn("Combats");
      dtm.addColumn("Duration of all combats");
      dtm.addColumn("Healing done");
      dtm.addColumn("HPS");
      for(Iterator<Participant> it=parser.getData().getHPSSortedParticipantList().iterator();it.hasNext();) {
        Participant p=it.next();
        dtm.addRow(new Object[]{p.getName(),p.getCombats(),p.getCombatDuration(),p.getHealingDone(),p.getHPS()});
      }
      dtm.fireTableDataChanged();
      allHPS.revalidate();
      allHPS.repaint();
     
      dtm=new DefaultTableModel();
      allDPST.setModel(dtm);
      dtm.addColumn("Participant");
      dtm.addColumn("Combats");
      dtm.addColumn("Duration of all combats");
      dtm.addColumn("Damage taken");
      dtm.addColumn("DTPS");
      for(Iterator<Participant> it=parser.getData().getDTPSSortedParticipantList().iterator();it.hasNext();) {
        Participant p=it.next();
        dtm.addRow(new Object[]{p.getName(),p.getCombats(),p.getCombatDuration(),p.getDamageTaken(),p.getDTPS()});
      }
      dtm.fireTableDataChanged();
      allDPST.revalidate();
      allDPST.repaint();
    }
    if(eventType==RRAMediator.EventCombatParticipantChanged) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      if(c==null) return;
      for(Iterator<CombatParticipant> it=c.getSortedDPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          // DPS Abilities
          DefaultTableModel tm=new DefaultTableModel();
          x1_dps1Stats.setModel(tm);
          tm.addColumn("Name");
          tm.addColumn("Hit");
          tm.addColumn("Crit");
          tm.addColumn("Miss");
          tm.addColumn("Dodge");
          tm.addColumn("Parry");
          tm.addColumn("Block");
          tm.addColumn("Absorb");
          tm.addColumn("Intercepted");
          for(Iterator<DPSStats> it2=cp.getDamageAbilityList().iterator();it2.hasNext();) {
            DPSStats xx=it2.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityDamage(DPSStats.OutcomeHit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeHit)+")",
                xx.getAbilityDamage(DPSStats.OutcomeCrit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeCrit)+")",
                xx.getOutcomeEventPercentages(DPSStats.OutcomeMiss),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeDodge),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeParry),
                xx.getAbilityDamage(DPSStats.OutcomeBlock)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeBlock)+")",
                xx.getAbilityDamage(DPSStats.OutcomeAbsorbed)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeAbsorbed)+")",
                xx.getAbilityDamage(DPSStats.OutcomeIntercepted)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeIntercepted)+")"});
          }
          tm.fireTableDataChanged();
          x1_dps1Stats.getColumnModel().getColumn(0).setMinWidth(150);
          x1_dps1Stats.getColumnModel().getColumn(1).setMinWidth(120);
          x1_dps1Stats.getColumnModel().getColumn(2).setMinWidth(120);
          x1_dps1Stats.getColumnModel().getColumn(3).setMinWidth(70);
          x1_dps1Stats.getColumnModel().getColumn(4).setMinWidth(70);
          x1_dps1Stats.getColumnModel().getColumn(5).setMinWidth(70);
          x1_dps1Stats.getColumnModel().getColumn(6).setMinWidth(120);
          x1_dps1Stats.getColumnModel().getColumn(7).setMinWidth(120);
          x1_dps1Stats.revalidate();
          x1_dps1Stats.repaint();
         
          tm=new DefaultTableModel();
          x1_dps2Stats.setModel(tm);
          tm.addColumn("Target");
          tm.addColumn("Hit");
          tm.addColumn("Crit");
          tm.addColumn("Miss");
          tm.addColumn("Dodge");
          tm.addColumn("Parry");
          tm.addColumn("Block");
          tm.addColumn("Absorb");
          tm.addColumn("Intercepted");
          for(Iterator<DPSStats> it3=cp.getDamageTargetList().iterator();it3.hasNext();) {
            DPSStats xx=it3.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityDamage(DPSStats.OutcomeHit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeHit)+")",
                xx.getAbilityDamage(DPSStats.OutcomeCrit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeCrit)+")",
                xx.getOutcomeEventPercentages(DPSStats.OutcomeMiss),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeDodge),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeParry),
                xx.getAbilityDamage(DPSStats.OutcomeBlock)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeBlock)+")",
                xx.getAbilityDamage(DPSStats.OutcomeAbsorbed)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeAbsorbed)+")",
                xx.getAbilityDamage(DPSStats.OutcomeIntercepted)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeIntercepted)+")"});
          }
          tm.fireTableDataChanged();
          x1_dps2Stats.getColumnModel().getColumn(0).setMinWidth(150);
          x1_dps2Stats.getColumnModel().getColumn(1).setMinWidth(120);
          x1_dps2Stats.getColumnModel().getColumn(2).setMinWidth(120);
          x1_dps2Stats.getColumnModel().getColumn(3).setMinWidth(70);
          x1_dps2Stats.getColumnModel().getColumn(4).setMinWidth(70);
          x1_dps2Stats.getColumnModel().getColumn(5).setMinWidth(70);
          x1_dps2Stats.getColumnModel().getColumn(6).setMinWidth(120);
          x1_dps2Stats.getColumnModel().getColumn(7).setMinWidth(120);
          x1_dps2Stats.revalidate();
          x1_dps2Stats.repaint();
                   
          tm=new DefaultTableModel();
          x1_dtps1Stats.setModel(tm);
          tm.addColumn("Ability");
          tm.addColumn("Hit");
          tm.addColumn("Crit");
          tm.addColumn("Miss");
          tm.addColumn("Dodge");
          tm.addColumn("Parry");
          tm.addColumn("Block");
          tm.addColumn("Absorb");
          tm.addColumn("Intercepted");
          for(Iterator<DPSStats> it3=cp.getDamageTakenAbilityList().iterator();it3.hasNext();) {
            DPSStats xx=it3.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityDamage(DPSStats.OutcomeHit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeHit)+")",
                xx.getAbilityDamage(DPSStats.OutcomeCrit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeCrit)+")",
                xx.getOutcomeEventPercentages(DPSStats.OutcomeMiss),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeDodge),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeParry),
                xx.getAbilityDamage(DPSStats.OutcomeBlock)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeBlock)+")",
                xx.getAbilityDamage(DPSStats.OutcomeAbsorbed)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeAbsorbed)+")",
                xx.getAbilityDamage(DPSStats.OutcomeIntercepted)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeIntercepted)+")"});
          }
          tm.fireTableDataChanged();
          x1_dtps1Stats.getColumnModel().getColumn(0).setMinWidth(150);
          x1_dtps1Stats.getColumnModel().getColumn(1).setMinWidth(120);
          x1_dtps1Stats.getColumnModel().getColumn(2).setMinWidth(120);
          x1_dtps1Stats.getColumnModel().getColumn(3).setMinWidth(70);
          x1_dtps1Stats.getColumnModel().getColumn(4).setMinWidth(70);
          x1_dtps1Stats.getColumnModel().getColumn(5).setMinWidth(70);
          x1_dtps1Stats.getColumnModel().getColumn(6).setMinWidth(120);
          x1_dtps1Stats.getColumnModel().getColumn(7).setMinWidth(120);
          x1_dtps1Stats.revalidate();
          x1_dtps1Stats.repaint();

          tm=new DefaultTableModel();
          x1_dtps2Stats.setModel(tm);
          tm.addColumn("Source");
          tm.addColumn("Hit");
          tm.addColumn("Crit");
          tm.addColumn("Miss");
          tm.addColumn("Dodge");
          tm.addColumn("Parry");
          tm.addColumn("Block");
          tm.addColumn("Absorb");
          tm.addColumn("Intercepted");
          for(Iterator<DPSStats> it3=cp.getDamageTakenTargetList().iterator();it3.hasNext();) {
            DPSStats xx=it3.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityDamage(DPSStats.OutcomeHit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeHit)+")",
                xx.getAbilityDamage(DPSStats.OutcomeCrit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeCrit)+")",
                xx.getOutcomeEventPercentages(DPSStats.OutcomeMiss),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeDodge),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeParry),
                xx.getAbilityDamage(DPSStats.OutcomeBlock)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeBlock)+")",
                xx.getAbilityDamage(DPSStats.OutcomeAbsorbed)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeAbsorbed)+")",
                xx.getAbilityDamage(DPSStats.OutcomeIntercepted)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeIntercepted)+")"});
          }
          tm.fireTableDataChanged();
          x1_dtps2Stats.getColumnModel().getColumn(0).setMinWidth(150);
          x1_dtps2Stats.getColumnModel().getColumn(1).setMinWidth(120);
          x1_dtps2Stats.getColumnModel().getColumn(2).setMinWidth(120);
          x1_dtps2Stats.getColumnModel().getColumn(3).setMinWidth(70);
          x1_dtps2Stats.getColumnModel().getColumn(4).setMinWidth(70);
          x1_dtps2Stats.getColumnModel().getColumn(5).setMinWidth(70);
          x1_dtps2Stats.getColumnModel().getColumn(6).setMinWidth(120);
          x1_dtps2Stats.getColumnModel().getColumn(7).setMinWidth(120);
          x1_dtps2Stats.revalidate();
          x1_dtps2Stats.repaint();
         

          tm=new DefaultTableModel();
          x1_dtpsTypes.setModel(tm);
          tm.addColumn("Damage type");
          tm.addColumn("Hit");
          tm.addColumn("Crit");
          tm.addColumn("Miss");
          tm.addColumn("Dodge");
          tm.addColumn("Parry");
          tm.addColumn("Block");
          tm.addColumn("Absorb");
          tm.addColumn("Intercepted");
          for(Iterator<DPSStats> it3=cp.getDamageTakenTypeList().iterator();it3.hasNext();) {
            DPSStats xx=it3.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityDamage(DPSStats.OutcomeHit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeHit)+")",
                xx.getAbilityDamage(DPSStats.OutcomeCrit)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeCrit)+")",
                xx.getOutcomeEventPercentages(DPSStats.OutcomeMiss),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeDodge),
                xx.getOutcomeEventPercentages(DPSStats.OutcomeParry),
                xx.getAbilityDamage(DPSStats.OutcomeBlock)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeBlock)+")",
                xx.getAbilityDamage(DPSStats.OutcomeAbsorbed)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeAbsorbed)+")",
                xx.getAbilityDamage(DPSStats.OutcomeIntercepted)+" ("+xx.getOutcomeEventPercentages(DPSStats.OutcomeIntercepted)+")"});
          }
          tm.fireTableDataChanged();
          x1_dtpsTypes.getColumnModel().getColumn(0).setMinWidth(150);
          x1_dtpsTypes.getColumnModel().getColumn(1).setMinWidth(120);
          x1_dtpsTypes.getColumnModel().getColumn(2).setMinWidth(120);
          x1_dtpsTypes.getColumnModel().getColumn(3).setMinWidth(70);
          x1_dtpsTypes.getColumnModel().getColumn(4).setMinWidth(70);
          x1_dtpsTypes.getColumnModel().getColumn(5).setMinWidth(70);
          x1_dtpsTypes.getColumnModel().getColumn(6).setMinWidth(120);
          x1_dtpsTypes.getColumnModel().getColumn(7).setMinWidth(120);
          x1_dtpsTypes.revalidate();
          x1_dtpsTypes.repaint();
         
          tm=new DefaultTableModel();
          x1_hps1Stats.setModel(tm);
          tm.addColumn("Ability");
          tm.addColumn("Healing");
          tm.addColumn("Overhealing");
          for(Iterator<HPSStats> it3=cp.getHealingAbilityList().iterator();it3.hasNext();) {
            HPSStats xx=it3.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityHealing()+" (crit "+xx.getHealingCritPercentage()+")",
                xx.getAbilityOverhealing()+" ("+xx.getOverhealingPercentage()+")"});
          }
          tm.fireTableDataChanged();
          x1_hps1Stats.revalidate();
          x1_hps1Stats.repaint();

          tm=new DefaultTableModel();
          x1_hps2Stats.setModel(tm);
          tm.addColumn("Target");
          tm.addColumn("Healing");
          tm.addColumn("Overhealing");
          for(Iterator<HPSStats> it3=cp.getHealingTargetList().iterator();it3.hasNext();) {
            HPSStats xx=it3.next();
            tm.addRow(new Object[]{xx.getAbilityName(),
                xx.getAbilityHealing()+" (crit "+xx.getHealingCritPercentage()+")",
                xx.getAbilityOverhealing()+" ("+xx.getOverhealingPercentage()+")"});
          }
          tm.fireTableDataChanged();
          x1_hps2Stats.revalidate();
          x1_hps2Stats.repaint();         

          x1_hps3Stats.setModel(new DefaultTableModel());
          x1_hps3Stats.revalidate();
          x1_hps3Stats.repaint();

          tm=new DefaultTableModel();
          interrupts.setModel(tm);
          tm.addColumn("Ability");
          tm.addColumn("Combat second");
          for(Iterator<InterruptStats> it3=cp.getInterruptList().iterator();it3.hasNext();) {
            InterruptStats xx=it3.next();
            long[] seconds=xx.getInterrupts();
            for(int i=0;i<seconds.length;i++)
              tm.addRow(new Object[]{xx.getAbilityName(),seconds[i]});
          }
          tm.fireTableDataChanged();
          interrupts.revalidate();
          interrupts.repaint()
         
          tm=new DefaultTableModel();
          deaths.setModel(tm);
          tm.addColumn("Killed by");
          tm.addColumn("Combat second");
          for(Iterator<DeathDetail> it3=cp.getDeathList().iterator();it3.hasNext();) {
            DeathDetail xx=it3.next();
            tm.addRow(new Object[]{xx.getKilledBy(),xx.getDiedAt()});
          }
          tm.fireTableDataChanged();
          deaths.revalidate();
          deaths.repaint()
        }
      }
    }
    if(eventType==RRAMediator.EventHealingTargetChanged) {
      Combat c=this.parser.getCombat((String)parameters.toArray()[0]);
      for(Iterator<CombatParticipant> it=c.getSortedDPSParticipantList().iterator();it.hasNext();) {
        CombatParticipant cp=it.next();
        if(cp.getName().equalsIgnoreCase((String)parameters.toArray()[1])) {
          for(Iterator<HPSStats> it3=cp.getHealingTargetList().iterator();it3.hasNext();) {
            HPSStats xx=it3.next();
            if(xx.getAbilityName().equalsIgnoreCase((String)parameters.toArray()[2])) {
View Full Code Here

TOP

Related Classes of rra.model.Combat

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.