use of com.ixale.starparse.domain.stats.DamageDealtStats in project StarParse by Ixale.
the class EventServiceTest method testFull.
@Test
public void testFull() throws Exception {
// load test source file
final File sourceLog = new File(getClass().getClassLoader().getResource("combat_2014-01-26_22_01_13_435268.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;
CombatStats stats = null;
DamageDealtStats dds = null;
List<DamageDealtStats> damageDealtStats = null;
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss.SSS", Locale.ENGLISH);
SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss.SSS", Locale.ENGLISH);
List<Combat> combats = eventService.getCombats();
assertEquals(31, combats.size());
assertEquals("Ixale", parser.getCombatLog().getCharacterName());
// verify combat 1
c = combats.get(1);
assertEquals("2014-01-27 01:10:34.526", sdf.format(c.getTimeFrom()));
assertEquals("Dread Master Calphayus (SM 8m)", c.getBoss().toString());
assertEquals(442874, c.getTimeTo() - c.getTimeFrom());
stats = eventService.getCombatStats(c, null, parser.getCombatLog().getCharacterName());
assertEquals(34.68, stats.getApm());
assertEquals(1018954, stats.getDamage());
assertEquals(2301, stats.getDps());
assertEquals(199588, stats.getHeal());
assertEquals(451, stats.getHps());
assertEquals(204, stats.getEhps());
assertEquals(45.31, stats.getEhpsPercent());
assertEquals(140364, stats.getDamageTaken());
assertEquals(317, stats.getDtps());
assertEquals(342032, stats.getHealTaken());
assertEquals(772, stats.getHpsTaken());
assertEquals(295, stats.getEhpsTaken());
assertEquals(1143416, stats.getThreat());
assertEquals(2582, stats.getTps());
assertEquals(1143416, stats.getThreatPositive());
assertEquals(8358, stats.getAbsorbed());
// verify combat 6
c = combats.get(6);
assertEquals("2014-01-27 01:31:59.110", sdf.format(c.getTimeFrom()));
assertEquals("Dread Master Raptus (HM 8m)", c.getBoss().toString());
assertEquals(394327, c.getTimeTo() - c.getTimeFrom());
stats = eventService.getCombatStats(c, null, parser.getCombatLog().getCharacterName());
assertEquals(32.41, stats.getApm());
assertEquals(874441, stats.getDamage());
assertEquals(2218, stats.getDps());
assertEquals(132737, stats.getHeal());
assertEquals(337, stats.getHps());
assertEquals(253, stats.getEhps());
assertEquals(75.21, stats.getEhpsPercent());
assertEquals(247176, stats.getDamageTaken());
assertEquals(627, stats.getDtps());
assertEquals(303582, stats.getHealTaken());
assertEquals(770, stats.getHpsTaken());
assertEquals(509, stats.getEhpsTaken());
assertEquals(14938, stats.getThreat());
assertEquals(38, stats.getTps());
assertEquals(845628, stats.getThreatPositive());
// verify combat 14
c = combats.get(14);
assertEquals("2014-01-27 02:05:31.950", sdf.format(c.getTimeFrom()));
assertEquals(null, c.getBoss());
assertEquals(61428, c.getTimeTo() - c.getTimeFrom());
assertEquals("Dwayna, Bartley, Dread Host Soldier (2), Dread Guard Nullifier, Dread Host Commando, Unknown", c.getName());
// verify combat 30
c = combats.get(30);
assertEquals("2014-01-27 02:51:10.836", sdf.format(c.getTimeFrom()));
assertEquals("Dread Master Brontes (SM 8m)", c.getBoss().toString());
assertEquals(444166, c.getTimeTo() - c.getTimeFrom());
stats = eventService.getCombatStats(c, null, parser.getCombatLog().getCharacterName());
damageDealtStats = eventService.getDamageDealtStats(c, false, false, false, null, parser.getCombatLog().getCharacterName());
assertEquals(1, damageDealtStats.size());
dds = damageDealtStats.get(0);
assertEquals("Total", dds.getName());
assertEquals(876, dds.getTicks());
assertEquals(2043.0, dds.getAverageCrit());
assertEquals(1248.0, dds.getAverageNormal());
assertEquals(33.22, dds.getPercentCrit());
assertEquals(7.76, dds.getPercentMiss());
assertEquals(594457, dds.getTotalCrit());
assertEquals(571678, dds.getTotalNormal());
assertEquals(1166135, dds.getTotal());
assertEquals(2625, dds.getDps());
assertEquals(100.0, dds.getPercentTotal());
damageDealtStats = eventService.getDamageDealtStats(c, false, false, true, null, parser.getCombatLog().getCharacterName());
assertEquals(12, damageDealtStats.size());
dds = damageDealtStats.get(0);
assertEquals("Overload Saber: Burning (Physical)", dds.getName());
// dots actions
assertEquals(31, dds.getActions());
assertEquals(144, dds.getTicks());
assertEquals(2291.0, dds.getAverageCrit());
assertEquals(1085.0, dds.getAverageNormal());
assertEquals(61.11, dds.getPercentCrit());
assertEquals(0.69, dds.getPercentMiss());
assertEquals(201615, dds.getTotalCrit());
assertEquals(53182, dds.getTotalNormal());
assertEquals(254797, dds.getTotal());
assertEquals(574, dds.getDps());
assertEquals(21.8, dds.getPercentTotal());
assertEquals("elemental", dds.getDamageType());
damageDealtStats = eventService.getDamageDealtStats(c, true, true, false, null, parser.getCombatLog().getCharacterName());
assertEquals(17, damageDealtStats.size());
dds = damageDealtStats.get(0);
assertEquals("Total", dds.getName());
assertEquals(420, dds.getTicks());
assertEquals(2065.0, dds.getAverageCrit());
assertEquals(33.33, dds.getPercentCrit());
damageDealtStats = eventService.getDamageDealtStatsSimple(c, null, parser.getCombatLog().getCharacterName());
assertEquals(1, damageDealtStats.size());
dds = damageDealtStats.get(0);
assertEquals("Total", dds.getName());
assertEquals(876, dds.getTicks());
assertEquals(33.22, dds.getPercentCrit());
assertEquals(7.76, dds.getPercentMiss());
assertEquals(2625, dds.getDps());
List<Effect> effects = eventService.getCombatEffects(c, null);
Effect effect;
assertEquals(301, effects.size());
effect = effects.get(0);
assertEquals("Power Surge", effect.getEffect().getName());
assertEquals(Long.valueOf(3244362460823552L), effect.getEffect().getGuid());
assertEquals("Ixale", effect.getSource().getName());
assertEquals(1, effect.getSource().getType().getId());
assertEquals("Ixale", effect.getTarget().getName());
assertEquals(1, effect.getTarget().getType().getId());
assertEquals("2014-01-27 02:51:12.873", sdf.format(effect.getTimeFrom()));
assertEquals("2014-01-27 02:51:18.933", sdf.format(effect.getTimeTo()));
assertFalse(effect.isAbsorption());
assertFalse(effect.isActivated());
effect = effects.get(102);
assertEquals("Kolto Cloud", effect.getEffect().getName());
assertEquals("Fathersheep", effect.getSource().getName());
assertEquals("Ixale", effect.getTarget().getName());
assertEquals("2014-01-27 02:53:49.941", sdf.format(effect.getTimeFrom()));
assertEquals("2014-01-27 02:53:59.028", sdf.format(effect.getTimeTo()));
assertFalse(effect.isAbsorption());
assertFalse(effect.isActivated());
effect = effects.get(153);
assertEquals("Force Armor", effect.getEffect().getName());
assertTrue(effect.isAbsorption());
assertFalse(effect.isActivated());
effect = effects.get(300);
assertEquals("Burning (Physical)", effect.getEffect().getName());
assertEquals("Ixale", effect.getSource().getName());
assertEquals("Dread Master Brontes", effect.getTarget().getName());
assertEquals("2014-01-27 02:58:32.268", sdf.format(effect.getTimeFrom()));
assertEquals("2014-01-27 02:58:35.035", sdf.format(effect.getTimeTo()));
assertFalse(effect.isAbsorption());
assertFalse(effect.isActivated());
/*long x = System.currentTimeMillis();
List<Event> events = eventService.getCombatEvents(c, EnumSet.noneOf(Event.Type.class), null, null, null, null);
System.out.println("Took: "+(System.currentTimeMillis() - x)+" ("+events.size()+")");
for (Event e: events) {
File f = new File("c:/x/e"+e.getEventId()+".log");
FileOutputStream fos = new FileOutputStream(f);
ObjectOutputStream out = new ObjectOutputStream(fos);
out.writeObject(e);
out.flush();
out.close();
fos.close();
}*/
/*context.reset();
events = null;
FileInputStream fin = new FileInputStream(f);
ObjectInputStream in = new ObjectInputStream(fin);
events = (List<Event>) in.readObject();
System.out.println(events.get(0).getSource().hashCode());
System.out.println(events.get(1).getSource().hashCode());
System.out.println(events.get(2).getSource().hashCode());
in.close();
fin.close();*/
// check combat extraction
c = combats.get(14);
assertEquals("2014-01-27 02:05:31.950", sdf.format(c.getTimeFrom()));
assertEquals("2014-01-27 02:06:33.378", sdf.format(c.getTimeTo()));
final String combat14 = FileLoader.extractPortion(sourceLog, "[" + sdfTime.format(c.getTimeFrom()), "[" + sdfTime.format(c.getTimeTo())).sb.toString();
assertNotNull(combat14);
assertEquals(58794, combat14.length());
}
use of com.ixale.starparse.domain.stats.DamageDealtStats in project StarParse by Ixale.
the class PersonalStatsPopoutPresenter method refreshDamageStats.
private void refreshDamageStats(final Combat combat, final CombatStats stats) throws Exception {
apm2.setText(Format.formatFloat(stats.getApm()));
time2.setText(Format.formatTime(stats.getTick()));
dps2.setText(Format.formatAdaptive(stats.getDps()));
damage2.setText(Format.formatAdaptive(stats.getDamage()));
final DamageDealtStats dds = eventService.getDamageDealtStatsSimple(combat, context.getCombatSelection(), context.getSelectedPlayer()).get(0);
critTotal2.setText(Format.formatNumber(dds.getTotalNormal() > 0 ? ((dds.getTotalCrit() * 100.0) / (dds.getTotalNormal() + dds.getTotalCrit())) : (dds.getTotalCrit() > 0 ? 100 : 0)) + " %");
crit2.setText(Format.formatNumber(dds.getPercentCrit()) + " %");
}
use of com.ixale.starparse.domain.stats.DamageDealtStats in project StarParse by Ixale.
the class DamageDealtPresenter method refreshCombatStats.
@Override
protected void refreshCombatStats(final Combat combat, final CombatStats stats) throws Exception {
if (targetTypeButton.isSelected()) {
targetInstanceButton.setDisable(false);
} else {
targetInstanceButton.setSelected(false);
targetInstanceButton.setDisable(true);
}
targetNameCol.setVisible((targetTypeButton.isSelected() || targetInstanceButton.isSelected()) || !abilityButton.isSelected());
targetTimeFromCol.setVisible(targetInstanceButton.isSelected());
nameCol.setVisible(abilityButton.isSelected());
actionsCol.setVisible(abilityButton.isSelected() && !targetTypeButton.isSelected() && !targetInstanceButton.isSelected());
if (combat == null) {
clearTable(damageDealtTable);
return;
}
final List<DamageAbilityItem> items = new ArrayList<>();
for (final DamageDealtStats dds : eventService.getDamageDealtStats(combat, targetTypeButton.isSelected(), targetInstanceButton.isSelected(), abilityButton.isSelected(), context.getCombatSelection(), context.getSelectedPlayer())) {
final DamageAbilityItem a = new DamageAbilityItem();
a.guid = dds.getGuid();
a.target.set(dds.getTarget());
a.name.set(dds.getName());
a.actions.set(dds.getActions());
a.ticks.set(dds.getTicks());
a.total.set(dds.getTotal());
a.pctTotal.set(dds.getPercentTotal());
a.avgNormal.set((int) dds.getAverageNormal());
a.avgCrit.set((int) dds.getAverageCrit());
a.avgTotal.set((int) dds.getAverageHit());
a.pctCrit.set(dds.getPercentCrit());
a.pctMiss.set(dds.getPercentMiss());
a.max.set(dds.getMax());
a.dps.set(dds.getDps());
a.damageType.set(dds.getDamageType());
if (dds.getTimeFrom() != null) {
a.since.set(Format.formatTime(dds.getTimeFrom() - combat.getTimeFrom()));
}
a.tickFrom.set(dds.getTimeFrom() - combat.getTimeFrom());
a.tickTo.set(dds.getTimeTo() - combat.getTimeFrom());
items.add(a);
}
damageDealtTable.getItems().setAll(items);
resortTable(damageDealtTable);
}
use of com.ixale.starparse.domain.stats.DamageDealtStats 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);
}
use of com.ixale.starparse.domain.stats.DamageDealtStats in project StarParse by Ixale.
the class CombatDaoImpl method getDamageDealtStatsSimple.
@Override
public List<DamageDealtStats> getDamageDealtStatsSimple(final Combat combat, final CombatSelection combatSel, final String playerName) throws Exception {
final Boundaries bounds = getBoundaries(combat, combatSel);
final Timestamp lookbehind = new Timestamp(bounds.timeFrom.getTime() - LOOKBEHIND_SECONDS * 1000);
final Map<String, Object> args = createArgs(bounds);
args.put("playerName", playerName == null ? getCharacterName(combat) : playerName);
args.put("behindEventIdFrom", bounds.eventIdFrom - LOOKBEHIND_EVENTS);
args.put("behindTimeFrom", lookbehind);
return getJdbcTemplate().query(SQL_GET_DAMAGE_DEALT_SIMPLE, args, (rs, rowNum) -> new DamageDealtStats("Total", "Total", 0L, rs.getInt("actions"), rs.getInt("ticks"), rs.getInt("ticks_normal"), rs.getInt("ticks_crit"), rs.getInt("ticks_miss"), rs.getInt("total"), rs.getInt("total_normal"), rs.getInt("total_crit"), rs.getInt("max"), rs.getInt("dps"), 0L, 0L, 0L, 0L, rs.getDouble("pct_crit"), rs.getDouble("pct_miss"), rs.getString("damage_type"), 0L, 0L));
}
Aggregations