skadistats.clarity.model.CombatLogEntry Java Examples

The following examples show how to use skadistats.clarity.model.CombatLogEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrackVisitor.java    From parser with MIT License 6 votes vote down vote up
@Override
public TrackStatus visit(int time, CombatLogEntry cle) {

	if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_MODIFIER_ADD && cle.getInflictorName().equals(BH_TRACK)) {
		trackStatus.put(cle.getTargetName(), new TrackStatus(cle.getAttackerName(), true));
	}

	if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_MODIFIER_REMOVE && cle.getInflictorName().equals(BH_TRACK)) {
		trackStatus.remove(cle.getTargetName());
	}

	if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_DEATH && trackStatus.getOrDefault(cle.getTargetName(), new TrackStatus()).tracked) {
		return trackStatus.get(cle.getTargetName());
	}

	return null;
}
 
Example #2
Source File: Wards.java    From parser with MIT License 5 votes vote down vote up
@OnCombatLogEntry
public void onCombatLogEntry(Context ctx, CombatLogEntry entry) {
    if (!isWardDeath(entry)) return;
    
    String killer;
    if ((killer = entry.getDamageSourceName()) != null) {
        wardKillersByWardClass.get(entry.getTargetName()).add(killer);
    }
}
 
Example #3
Source File: GreevilsGreedVisitor.java    From parser with MIT License 5 votes vote down vote up
@Override
public Integer visit(int time, CombatLogEntry cle) {
       if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_MODIFIER_ADD
       		&& cle.getAttackerName().equals("npc_dota_hero_alchemist")
       		&& cle.getInflictorName().equals("modifier_alchemist_goblins_greed")
       		&& !cle.isAttackerIllusion()) {
       	greevilsGreedLearned = true;
       }
       
       if (greevilsGreedLearned
       		&& cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_DEATH
       		&& cle.getAttackerName().equals("npc_dota_hero_alchemist")
       		&& !cle.isAttackerIllusion()) {

       	if (isDeny(cle.getTargetName())) {
       		return null;
       	}
       	
       	Iterator<Integer> iterator = lastHitTimings.iterator();
		while(iterator.hasNext()) {
       		Integer lhTiming = iterator.next();
			boolean isExpired = lhTiming + GREEVILS_GREED_WINDOW < time;
			if (isExpired) {
       			iterator.remove();
       		}
       	}
       	
		int currentStack = lastHitTimings.size();
       	
       	lastHitTimings.add(time);
       	
       	return currentStack;
       }
       return null;
}
 
Example #4
Source File: CombatLog.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@OnTickEnd
public void onTickEnd(boolean synthetic) {
    for (CombatLogEntry e : logEntries) {
        evCombatLogEntry.raise(e);
    }
    logEntries.clear();
}
 
Example #5
Source File: Parse.java    From parser with MIT License 4 votes vote down vote up
@OnCombatLogEntry
public void onCombatLogEntry(Context ctx, CombatLogEntry cle) {
    try 
    {
        time = Math.round(cle.getTimestamp());
        //create a new entry
        Entry combatLogEntry = new Entry(time);
        combatLogEntry.type = cle.getType().name();
        //translate the fields using string tables if necessary (get*Name methods)
        combatLogEntry.attackername = cle.getAttackerName();
        combatLogEntry.targetname = cle.getTargetName();
        combatLogEntry.sourcename = cle.getDamageSourceName();
        combatLogEntry.targetsourcename = cle.getTargetSourceName();
        combatLogEntry.inflictor = cle.getInflictorName();
        combatLogEntry.attackerhero = cle.isAttackerHero();
        combatLogEntry.targethero = cle.isTargetHero();
        combatLogEntry.attackerillusion = cle.isAttackerIllusion();
        combatLogEntry.targetillusion = cle.isTargetIllusion();
        combatLogEntry.value = cle.getValue();
        float stunDuration = cle.getStunDuration();
        if (stunDuration > 0) {
        	combatLogEntry.stun_duration = stunDuration;
        }
        float slowDuration = cle.getSlowDuration();
        if (slowDuration > 0) {
        	combatLogEntry.slow_duration = slowDuration;
        }
        //value may be out of bounds in string table, we can only get valuename if a purchase (type 11)
        if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_PURCHASE) {
            combatLogEntry.valuename = cle.getValueName();
        }
        else if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_GOLD) {
            combatLogEntry.gold_reason = cle.getGoldReason();
        }
        else if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_XP) {
            combatLogEntry.xp_reason = cle.getXpReason();
        }
        
        combatLogEntry.greevils_greed_stack = greevilsGreedVisitor.visit(time, cle);
        TrackStatus trackStatus = trackVisitor.visit(time, cle);
        if (trackStatus != null) {
        	combatLogEntry.tracked_death = trackStatus.tracked;
        	combatLogEntry.tracked_sourcename = trackStatus.inflictor;
        }
        if (combatLogEntry.type.equals("DOTA_COMBATLOG_GAME_STATE") && combatLogEntry.value == 6) {
            postGame = true;
        }
        if (combatLogEntry.type.equals("DOTA_COMBATLOG_GAME_STATE") && combatLogEntry.value == 5) {
            //alternate to combat log for getting game zero time (looks like this is set at the same time as the game start, so it's not any better for streaming)
            // int currGameStartTime = Math.round( (float) grp.getProperty("m_pGameRules.m_flGameStartTime"));
            if (gameStartTime == 0) {
                gameStartTime = combatLogEntry.time;
                flushLogBuffer();
            }
        }
        if (cle.getType().ordinal() <= 19) {	
            output(combatLogEntry);
 }
    }
    catch(Exception e)
    {
        System.err.println(e);
        System.err.println(cle);
    }
}
 
Example #6
Source File: Wards.java    From parser with MIT License 4 votes vote down vote up
private boolean isWardDeath(CombatLogEntry e) {
    return e.getType().equals(DotaUserMessages.DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_DEATH)
            && WARDS_TARGET_NAMES.contains(e.getTargetName());
}
 
Example #7
Source File: Main.java    From clarity-examples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private String getAttackerNameCompiled(CombatLogEntry cle) {
    return compileName(cle.getAttackerName(), cle.isAttackerIllusion());
}
 
Example #8
Source File: Main.java    From clarity-examples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private String getTargetNameCompiled(CombatLogEntry cle) {
    return compileName(cle.getTargetName(), cle.isTargetIllusion());
}
 
Example #9
Source File: Visitor.java    From parser with MIT License votes vote down vote up
T visit(int time, CombatLogEntry cle);