Search in sources :

Example 1 with HealingTakenStats

use of com.ixale.starparse.domain.stats.HealingTakenStats in project StarParse by Ixale.

the class CombatDaoImpl method getHealingTakenStats.

@Override
public List<HealingTakenStats> getHealingTakenStats(final Combat combat, boolean bySource, boolean byAbility, final CombatSelection combatSel, final String playerName) throws Exception {
    final Boundaries bounds = getBoundaries(combat, combatSel);
    final Map<String, Object> args = createArgs(bounds);
    args.put("playerName", playerName == null ? getCharacterName(combat) : playerName);
    StringBuilder pivotsCols = new StringBuilder(), pivotsWhere = new StringBuilder(), pivotsGroup = new StringBuilder();
    if (bySource) {
        pivotsCols.append(", e.source_name, 0 source_instance");
        pivotsGroup.append(", e.source_name");
    } else {
        pivotsCols.append(", 'Total' source_name, 0 source_instance");
    }
    if (byAbility) {
        pivotsCols.append(", e.ability_name, e.ability_guid");
        pivotsGroup.append(", e.ability_name, e.ability_guid");
    } else {
        pivotsCols.append(", 'Total' ability_name, 0 ability_guid");
    }
    return getJdbcTemplate().query(SQL_GET_HEALING_TAKEN_TOTALS.replace("%pivots_cols", pivotsCols.substring(2)).replace("%pivots_where", pivotsWhere.length() > 0 ? pivotsWhere : "").replace("%pivots_group", pivotsGroup.length() > 0 ? pivotsGroup.substring(2) : "1"), args, (rs, rowNum) -> new HealingTakenStats(rs.getString("source_name"), rs.getString("ability_name"), rs.getLong("ability_guid"), rs.getInt("ticks"), rs.getInt("ticks_normal"), rs.getInt("ticks_crit"), rs.getInt("total"), rs.getInt("total_normal"), rs.getInt("total_crit"), rs.getInt("total_effective"), rs.getInt("htps"), rs.getInt("ehtps"), rs.getDouble("pct_total"), rs.getDouble("avg_normal"), rs.getDouble("avg_crit"), rs.getDouble("pct_crit"), rs.getDouble("pct_effective"), rs.getInt("aps"), rs.getInt("absorbed"), getTimestamp(rs, (getTimestamp(rs, "source_time_from") != null ? "source_time_from" : "sub_time_from")).getTime(), getTimestamp(rs, (getTimestamp(rs, "source_time_to") != null ? "source_time_to" : "sub_time_to")).getTime()));
}
Also used : HealingTakenStats(com.ixale.starparse.domain.stats.HealingTakenStats)

Example 2 with HealingTakenStats

use of com.ixale.starparse.domain.stats.HealingTakenStats in project StarParse by Ixale.

the class HealingTakenPresenter method refreshCombatStats.

@Override
protected void refreshCombatStats(final Combat combat, final CombatStats stats) throws Exception {
    sourceNameCol.setVisible(sourceButton.isSelected() || !abilityButton.isSelected());
    nameCol.setVisible(abilityButton.isSelected());
    if (combat == null) {
        clearTable(healingTakenTable);
        return;
    }
    final List<HealingTakenItem> items = new ArrayList<>();
    for (HealingTakenStats hts : eventService.getHealingTakenStats(combat, sourceButton.isSelected(), abilityButton.isSelected(), context.getCombatSelection(), context.getSelectedPlayer())) {
        final HealingTakenItem a = new HealingTakenItem();
        a.guid = hts.getGuid();
        a.source.set(hts.getSource());
        a.name.set(hts.getName());
        a.ticks.set(hts.getTicks());
        a.total.set(hts.getTotal());
        a.totalEffective.set(hts.getTotalEffective());
        a.pctTotal.set(hts.getPercentTotal());
        a.avgNormal.set((int) hts.getAverageNormal());
        a.avgCrit.set((int) hts.getAverageCrit());
        a.pctCrit.set(hts.getPercentCrit());
        a.pctEffective.set(hts.getPercentEffective());
        a.htps.set(hts.getHtps());
        a.ehtps.set(hts.getEhtps());
        if (hts.getAbsorbed() > 0) {
            a.aps.set(hts.getAps());
            a.absorbed.set(hts.getAbsorbed());
        }
        a.tickFrom.set(hts.getTimeFrom() - combat.getTimeFrom());
        a.tickTo.set(hts.getTimeTo() - combat.getTimeFrom());
        items.add(a);
    }
    healingTakenTable.getItems().setAll(items);
    resortTable(healingTakenTable);
}
Also used : HealingTakenItem(com.ixale.starparse.gui.table.item.HealingTakenItem) HealingTakenStats(com.ixale.starparse.domain.stats.HealingTakenStats) ArrayList(java.util.ArrayList)

Example 3 with HealingTakenStats

use of com.ixale.starparse.domain.stats.HealingTakenStats in project StarParse by Ixale.

the class EventServiceTest method testStatsFull.

@Test
public void testStatsFull() throws Exception {
    // load test source file
    final File sourceLog = new File(getClass().getClassLoader().getResource("combat_2014-02-26_03_01_11_705182.txt").toURI());
    parser.setCombatLogFile(sourceLog);
    // check DAO
    eventService.storeCombatLog(parser.getCombatLog());
    // parse one by one, with intermediary flushes
    FileReader fr = null;
    BufferedReader br = null;
    try {
        fr = new FileReader(sourceLog);
        br = new BufferedReader(fr);
        String line;
        int i = 0;
        while ((line = br.readLine()) != null) {
            parser.parseLogLine(line);
            if (++i % 3000 == 0) {
                eventService.flushEvents(parser.getEvents(), parser.getCombats(), parser.getCurrentCombat(), parser.getEffects(), parser.getCurrentEffects(), parser.getPhases(), parser.getCurrentPhase(), parser.getAbsorptions(), parser.getActorStates());
            }
        }
        eventService.flushEvents(parser.getEvents(), parser.getCombats(), parser.getCurrentCombat(), parser.getEffects(), parser.getCurrentEffects(), parser.getPhases(), parser.getCurrentPhase(), parser.getAbsorptions(), parser.getActorStates());
    } finally {
        try {
            br.close();
        } catch (Exception ignored) {
        }
        try {
            fr.close();
        } catch (Exception ignored) {
        }
    }
    // check result
    Combat c = null;
    DamageDealtStats dds = null;
    List<DamageDealtStats> damageDealtStats = null;
    DamageTakenStats dts = null;
    List<DamageTakenStats> damageTakenStats = null;
    CombatMitigationStats cms = null;
    HealingTakenStats hts = null;
    List<HealingTakenStats> healingTakenStats = null;
    SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss.SSS", Locale.ENGLISH);
    List<Combat> combats = eventService.getCombats();
    assertEquals(25, combats.size());
    assertEquals("Ixaar", parser.getCombatLog().getCharacterName());
    // verify combat 25
    c = combats.get(24);
    assertEquals("2014-02-26 04:28:04.902", sdf.format(c.getTimeFrom()));
    assertEquals("Dread Master Brontes (HM 8m)", c.getBoss().toString());
    assertEquals(420490, c.getTimeTo() - c.getTimeFrom());
    // damage dealt
    damageDealtStats = eventService.getDamageDealtStats(c, false, false, true, null, parser.getCombatLog().getCharacterName());
    assertEquals(15, damageDealtStats.size());
    dds = damageDealtStats.get(0);
    assertEquals("Blade Storm", dds.getName());
    assertEquals(27, dds.getTicks());
    assertEquals(2857.0, dds.getAverageCrit());
    assertEquals(1852.0, dds.getAverageNormal());
    // damage taken
    damageTakenStats = eventService.getDamageTakenStats(c, false, false, true, null, parser.getCombatLog().getCharacterName());
    assertEquals(14, damageTakenStats.size());
    dts = damageTakenStats.get(1);
    assertEquals("Fire and Forget", dts.getName());
    assertEquals(120, dts.getTicks());
    assertEquals(12.5, dts.getPercentMiss());
    assertEquals(37.5, dts.getPercentShield());
    assertEquals(703.0, dts.getAverageNormal());
    assertEquals(6818, dts.getTotalAbsorbed());
    assertEquals(84343, dts.getTotal());
    // mitigation
    cms = eventService.getCombatMitigationStats(c, null, parser.getCombatLog().getCharacterName());
    assertEquals(275, cms.getTicks());
    assertEquals(491144, cms.getDamage());
    assertEquals(13141, cms.getInternal());
    assertEquals(2.7, cms.getInternalPercent());
    assertEquals(77469, cms.getElemental());
    assertEquals(15.8, cms.getElementalPercent());
    assertEquals(68449, cms.getEnergy());
    assertEquals(13.9, cms.getEnergyPercent());
    assertEquals(332085, cms.getKinetic());
    assertEquals(67.6, cms.getKineticPercent());
    assertEquals(22.2, cms.getMissPercent());
    assertEquals(27.3, cms.getShieldPercent());
    assertEquals(86381, cms.getAbsorbedSelf() + cms.getAbsorbedOthers());
    assertEquals(17.6, cms.getAbsorbedSelfPercent() + cms.getAbsorbedOthersPercent());
    assertEquals(205, cms.getAps());
    // absorptions & healing
    healingTakenStats = eventService.getHealingTakenStats(c, true, true, null, parser.getCombatLog().getCharacterName());
    assertEquals(15, healingTakenStats.size());
    hts = healingTakenStats.get(0);
    assertNotNull(hts);
}
Also used : DamageTakenStats(com.ixale.starparse.domain.stats.DamageTakenStats) HealingTakenStats(com.ixale.starparse.domain.stats.HealingTakenStats) CombatMitigationStats(com.ixale.starparse.domain.stats.CombatMitigationStats) Combat(com.ixale.starparse.domain.Combat) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) File(java.io.File) SimpleDateFormat(java.text.SimpleDateFormat) DamageDealtStats(com.ixale.starparse.domain.stats.DamageDealtStats) Test(org.junit.Test)

Aggregations

HealingTakenStats (com.ixale.starparse.domain.stats.HealingTakenStats)3 Combat (com.ixale.starparse.domain.Combat)1 CombatMitigationStats (com.ixale.starparse.domain.stats.CombatMitigationStats)1 DamageDealtStats (com.ixale.starparse.domain.stats.DamageDealtStats)1 DamageTakenStats (com.ixale.starparse.domain.stats.DamageTakenStats)1 HealingTakenItem (com.ixale.starparse.gui.table.item.HealingTakenItem)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 FileReader (java.io.FileReader)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1