Search in sources :

Example 1 with LocationInfo

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

the class RaidBossPopoutPresenter method setTitle.

private void setTitle(final Combat combat) {
    if (combat != null && combat.getBoss() != null) {
        popoutTitle.setText(getShortNameForTitle(combat.getBoss().getRaidBossName().getShortName()) + " " + combat.getBoss().getMode() + " " + combat.getBoss().getSize());
        return;
    }
    final LocationInfo locationInfo;
    if (combat != null && context.getCombatInfo().get(combat.getCombatId()) != null) {
        locationInfo = context.getCombatInfo().get(combat.getCombatId()).getLocationInfo();
    } else {
        locationInfo = context.getLocationInfo();
    }
    if (locationInfo != null) {
        final String zone = getShortNameForTitle(locationInfo.getInstanceName());
        popoutTitle.setText(zone == null || zone.isEmpty() ? "" : (zone + " ") + locationInfo.getInstanceDifficulty());
    } else {
        popoutTitle.setText("Raid Boss");
    }
}
Also used : LocationInfo(com.ixale.starparse.domain.LocationInfo)

Example 2 with LocationInfo

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

the class Parser method parseInstanceType.

private void parseInstanceType(final String instanceName, final String instanceGuid, final String instanceType, final String instanceTypeGuid, final long timestamp) {
    Raid.Size s = null;
    Raid.Mode m = null;
    if ("836045448953652".equals(instanceTypeGuid)) {
        s = Size.Eight;
        m = Mode.HM;
    } else if ("836045448953651".equals(instanceTypeGuid)) {
        s = Size.Eight;
        m = Mode.SM;
    } else if ("836045448953655".equals(instanceTypeGuid)) {
        s = Size.Eight;
        m = Mode.NiM;
    } else if (instanceType != null) {
        if (instanceType.contains("16 ") || instanceType.contains("16�")) {
            s = Size.Sixteen;
        } else if (instanceType.contains("8 ") || instanceType.contains("8�")) {
            s = Size.Eight;
        }
        if (instanceType.contains("Story") || instanceType.contains("histoire")) {
            m = Mode.SM;
        } else if (instanceType.contains("Veteran") || instanceType.contains("v�t�ran")) {
            m = Mode.HM;
        } else if (instanceType.contains("Master") || instanceType.contains("ma�tre")) {
            m = Mode.NiM;
        }
    }
    if (instanceName != null) {
        this.instanceName = instanceName;
    }
    if (instanceGuid != null) {
        this.instanceGuid = Long.valueOf(instanceGuid);
    }
    if (s != null && m != null) {
        instanceMode = m;
        instanceSize = s;
        if (logger.isDebugEnabled()) {
            logger.debug("Instance set as " + s + " " + m + " (" + instanceName + " " + instanceGuid + ") at " + Event.formatTs(timestamp));
        }
        context.setLocationInfo(new LocationInfo(instanceMode, instanceSize, instanceName, this.instanceGuid));
    }
}
Also used : Size(com.ixale.starparse.domain.Raid.Size) Mode(com.ixale.starparse.domain.Raid.Mode) Raid(com.ixale.starparse.domain.Raid) LocationInfo(com.ixale.starparse.domain.LocationInfo)

Example 3 with LocationInfo

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

the class Parser method processEventCombat.

public void processEventCombat(final Event e) {
    // resolve combat
    if (combatConnectLimit != null && combatConnectLimit < e.getTimestamp()) {
        // window expired, close the running combat for good
        closeCurrentCombat();
    }
    final ActorState ac = actorStates.get(e.getSource());
    if (isEffectEnterCombat(e) && !isSourceOtherPlayer(e)) /* safety vor v7+ */
    {
        if (combatConnectLimit != null) {
            // within limit, reopen last combat
            combat.setEventIdTo(null);
            combat.setTimeTo(null);
            combatConnectLimit = null;
        } else if (combat != null) {
            // sometimes new combat is created even without exiting the previous one
            if (logger.isDebugEnabled()) {
                logger.debug("New combat was entered without exiting the previous one, silently connecting");
            }
        } else {
            // setup new combat
            combat = new Combat(++combatId, combatLogId, e.getTimestamp(), e.getEventId());
            context.getCombatInfo().put(combat.getCombatId(), new CombatInfo(new LocationInfo(instanceMode, instanceSize, instanceName, instanceGuid)));
            for (final Actor a : actorStates.keySet()) {
                // might have re-specced
                actorStates.get(a).role = null;
                actorStates.get(a).discipline = null;
            }
            if (isUsingMimCrystal) {
                context.addCombatEvent(combat.getCombatId(), e.getSource(), Event.Type.NIM_CRYSTAL, e.getTimestamp());
            }
            // assemble combat players; make sure SELF is there
            for (Map.Entry<Actor, ActorState> entry : actorStates.entrySet()) {
                entry.getValue().combatTotalThreat = 0;
                if (Actor.Type.SELF.equals(entry.getKey().getType())) {
                    context.addCombatPlayer(combat, entry.getKey(), entry.getKey().getDiscipline());
                    break;
                }
            }
        }
    } else if (combat != null && combatConnectLimit == null && (isEffectExitCombat(e) || (isTargetThisPlayer(e) && isEffectDeath(e)) || isEffectLoginImmunity(e))) {
        // exit event detected (and no window is set yet), setup candidates
        combat.setEventIdTo(e.getEventId());
        combat.setTimeTo(e.getTimestamp());
        if (isEffectExitCombat(e)) {
            context.addCombatEvent(combat.getCombatId(), e.getSource(), Event.Type.COMBAT_EXIT, e.getTimestamp());
        }
        // ... and setup limit for either revive or quick reconnect (and for lagged damage and healing)
        combatConnectLimit = e.getTimestamp() + (isEffectDeath(e) ? // died - setup REVIVE limit
        COMBAT_REVIVE_WINDOW : ((lastCombatDropEvent != null && (lastCombatDropEvent.getTimestamp() > (e.getTimestamp() - COMBAT_RETURN_WINDOW)) ? // recent (yet already consumed) combat drop event - "drop->enter->exit[now]->?enter" sequence can happen - setup RETURN window
        COMBAT_RETURN_WINDOW : // just regular window for delayed damage/healing events
        COMBAT_DELAY_WINDOW)));
    } else if (combat != null && combatConnectLimit != null) {
        if (isTargetThisPlayer(e) && isEffectRevive(e)) {
            // revived within REVIVE limit, setup RETURN limit and keep waiting
            combatConnectLimit = e.getTimestamp() + COMBAT_RETURN_WINDOW;
        } else if (isTargetThisPlayer(e) && isEffectCombatDrop(e)) {
            // combat drop detected within DELAY window, setup RETURN limit and keep waiting
            combatConnectLimit = e.getTimestamp() + COMBAT_RETURN_WINDOW;
            // all combat drops are suspicious as you can drop, enter, kill/discard add, exit combat and then enter again (e.g. Raptus challenge)
            lastCombatDropEvent = e;
        } else if (isSourceThisPlayer(e) && e.getValue() != null && (e.getThreat() != null || isEffectDamage(e))) {
            // gracefully include any delayed damage/healing abilities
            // (after dying, DOTs can be still ticking, although causing no threat)
            combat.setEventIdTo(e.getEventId());
        // combat.setTimeTo(e.getTimestamp()); // do not extend, keep the original time
        }
    }
    if (combat != null && isEffectDeath(e)) {
        context.addCombatEvent(combat.getCombatId(), e.getTarget(), Event.Type.DEATH, e.getTimestamp());
    }
    // resolve effective threat
    if (combat != null && ac != null && e.getThreat() != null) {
        if (ac.combatTotalThreat + e.getThreat() < 0) {
            e.setEffectiveThreat(ac.combatTotalThreat * -1);
            ac.combatTotalThreat = 0;
        } else {
            e.setEffectiveThreat(e.getThreat());
            ac.combatTotalThreat += e.getThreat();
        }
    }
    // resolve combat phase (ignore target set/cleared to avoid confusion)
    if (combat != null && combat.getBoss() != null && !(e.getEffect() != null && (e.getEffect().getGuid().equals(EntityGuid.TargetSet.getGuid()) || e.getEffect().getGuid().equals(EntityGuid.TargetCleared.getGuid())))) {
        final String newBossPhaseName;
        if ((newBossPhaseName = combat.getBoss().getRaid().getNewPhaseName(e, combat, currentBossPhase != null ? currentBossPhase.getName() : null)) != null) {
            // new phase detected
            if (currentBossPhase != null) {
                // close old - bounds are explicitly as <from, to)
                closePhase(currentBossPhase, e.getEventId() - 1, e.getTimestamp() - combat.getTimeFrom() - 1);
            }
            // setup new (if this is the very first one, assume it started at the beginning of this combat)
            currentBossPhase = new Phase(++phaseId, newBossPhaseName, Phase.Type.BOSS, combat.getCombatId(), (currentBossPhase == null ? combat.getEventIdFrom() : e.getEventId()), (currentBossPhase == null ? 0 : e.getTimestamp() - combat.getTimeFrom()));
        }
        if (combatBossUpgrade != null && e.getAbility() != null && e.getAbility().getGuid() != null) {
            resolveCombatUpgrade(combatBossUpgrade.upgradeByAbility(e.getAbility().getGuid(), e.getEffect().getGuid(), e.getValue()), false);
        }
    }
    // resolve damage phase
    if (combat != null && isSourceThisPlayer(e) && isEffectDamage(e) && e.getValue() > 0) {
        if (firstDamageEvent == null) {
            // open new damage phase
            firstDamageEvent = e;
        } else if (lastDamageEvent != null && (lastDamageEvent.getTimestamp() + PHASE_DAMAGE_WINDOW < e.getTimestamp())) {
            // close damage phase and open new one
            createDamagePhase(firstDamageEvent, lastDamageEvent);
            lastDamageEvent = null;
            firstDamageEvent = e;
        } else {
            // prolong current damage phase
            lastDamageEvent = e;
        }
    }
    // resolve discipline
    if (combat != null && ac != null && ac.discipline == null) {
        if (!ac.isDualWield && isEffectDualWield(e)) {
            ac.isDualWield = true;
        }
        if (isEffectAbilityActivate(e)) {
            ac.discipline = getDiscipline(e.getAbility().getGuid(), ac.isDualWield);
            if (ac.discipline != null) {
                ac.role = ac.discipline.getRole();
                if (logger.isDebugEnabled()) {
                    logger.debug(e.getSource() + ": Discipline detected as [" + ac.discipline + "] at " + e.getTs());
                }
                if (isEffectiveLogged || Actor.Type.SELF.equals(e.getSource().getType())) {
                    context.addCombatPlayer(combat, e.getSource(), ac.discipline);
                }
                if (isSourceThisPlayer(e)) {
                    // self
                    if (!CharacterRole.HEALER.equals(ac.discipline.getRole())) {
                        // make sure its reset
                        clearHotsTracking();
                    }
                }
            }
        }
    }
}
Also used : CombatInfo(com.ixale.starparse.domain.CombatInfo) Phase(com.ixale.starparse.domain.Phase) Helpers.isEffectEnterCombat(com.ixale.starparse.parser.Helpers.isEffectEnterCombat) Helpers.isEffectExitCombat(com.ixale.starparse.parser.Helpers.isEffectExitCombat) Combat(com.ixale.starparse.domain.Combat) Actor(com.ixale.starparse.domain.Actor) LocationInfo(com.ixale.starparse.domain.LocationInfo)

Aggregations

LocationInfo (com.ixale.starparse.domain.LocationInfo)3 Actor (com.ixale.starparse.domain.Actor)1 Combat (com.ixale.starparse.domain.Combat)1 CombatInfo (com.ixale.starparse.domain.CombatInfo)1 Phase (com.ixale.starparse.domain.Phase)1 Raid (com.ixale.starparse.domain.Raid)1 Mode (com.ixale.starparse.domain.Raid.Mode)1 Size (com.ixale.starparse.domain.Raid.Size)1 Helpers.isEffectEnterCombat (com.ixale.starparse.parser.Helpers.isEffectEnterCombat)1 Helpers.isEffectExitCombat (com.ixale.starparse.parser.Helpers.isEffectExitCombat)1