Java Code Examples for skadistats.clarity.model.CombatLogEntry#isAttackerIllusion()

The following examples show how to use skadistats.clarity.model.CombatLogEntry#isAttackerIllusion() . 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: 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 2
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);
    }
}