Search in sources :

Example 1 with AbsorptionStats

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

the class CombatDaoImpl method getAbsorptionStats.

@Override
public List<AbsorptionStats> getAbsorptionStats(final Combat combat, final CombatSelection combatSel, final String playerName) throws Exception {
    final Boundaries bounds = getBoundaries(combat, combatSel);
    final Map<String, Object> args = new HashMap<>();
    args.put("eventIdFrom", bounds.eventIdFrom);
    args.put("eventIdTo", bounds.eventIdTo);
    args.put("playerName", playerName == null ? getCharacterName(combat) : playerName);
    return getJdbcTemplate().query(SQL_GET_ABSORPTION_TAKEN_TOTALS, args, (rs, rowNum) -> new AbsorptionStats(rs.getString("source_name"), EntityGuid.fromGuid(rs.getLong("effect_guid"), rs.getString("effect_name")), rs.getInt("total")));
}
Also used : HashMap(java.util.HashMap) AbsorptionStats(com.ixale.starparse.domain.stats.AbsorptionStats)

Example 2 with AbsorptionStats

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

the class RaidPresenter method getShieldingSelf.

// TODO: move this somewhere more proper
public int[] getShieldingSelf(int tick) throws Exception {
    if (lastCombat == null || combatLogName == null || characterName == null) {
        return null;
    }
    if (!raidTable.getItems().isEmpty() && context.getCombatSelection() == null) {
        // load from normally from the table
        return new int[] { getShieldingTotal(characterName), getShieldingPerSecond(characterName) };
    }
    // try to load from the cache (if raiding was active)
    final Collection<RaidCombatMessage> messages = getCombatUpdates(combatLogName, lastCombat);
    int total = 0;
    if (messages != null && context.getCombatSelection() == null) {
        for (final RaidCombatMessage message : messages) {
            if (message.getAbsorptionStats() != null) {
                for (final AbsorptionStats s : message.getAbsorptionStats()) {
                    if (characterName.equals(s.getSource())) {
                        total += s.getTotal();
                    }
                }
            }
        }
    } else {
        // last resort - load parsed data (self-only)
        final List<AbsorptionStats> as = eventService.getAbsorptionStats(lastCombat, context.getCombatSelection(), characterName);
        for (final AbsorptionStats abs : as) {
            if (characterName.equals(abs.getSource())) {
                total += abs.getTotal();
            }
        }
    }
    return new int[] { total, tick <= 0 ? 0 : (int) Math.round(total * 1000.0 / tick) };
}
Also used : RaidCombatMessage(com.ixale.starparse.ws.RaidCombatMessage) AbsorptionStats(com.ixale.starparse.domain.stats.AbsorptionStats)

Example 3 with AbsorptionStats

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

the class RaidPresenter method fillAbsorption.

private void fillAbsorption(final RaidItem item) {
    int total = 0;
    for (String target : absorptions.keySet()) {
        for (AbsorptionStats as : absorptions.get(target)) {
            if (Format.getRealNameEvenForFakePlayer(item.getName()).equals(as.getSource())) {
                total += as.getTotal();
            }
        }
    }
    item.shielding.set(total);
    item.sps.set((int) Math.round(total * 1000.0 / item.time.get()));
}
Also used : AbsorptionStats(com.ixale.starparse.domain.stats.AbsorptionStats)

Aggregations

AbsorptionStats (com.ixale.starparse.domain.stats.AbsorptionStats)3 RaidCombatMessage (com.ixale.starparse.ws.RaidCombatMessage)1 HashMap (java.util.HashMap)1