Java源码示例:skadistats.clarity.model.CombatLogEntry

示例1
@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;
}
 
示例2
@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);
    }
}
 
示例3
@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;
}
 
示例4
@OnTickEnd
public void onTickEnd(boolean synthetic) {
    for (CombatLogEntry e : logEntries) {
        evCombatLogEntry.raise(e);
    }
    logEntries.clear();
}
 
示例5
@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);
    }
}
 
示例6
private boolean isWardDeath(CombatLogEntry e) {
    return e.getType().equals(DotaUserMessages.DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_DEATH)
            && WARDS_TARGET_NAMES.contains(e.getTargetName());
}
 
示例7
private String getAttackerNameCompiled(CombatLogEntry cle) {
    return compileName(cle.getAttackerName(), cle.isAttackerIllusion());
}
 
示例8
private String getTargetNameCompiled(CombatLogEntry cle) {
    return compileName(cle.getTargetName(), cle.isTargetIllusion());
}
 
示例9
T visit(int time, CombatLogEntry cle);