protected override bool InitCombatReplay(ParsedEvtcLog log) { if (base.InitCombatReplay(log)) { // Trim DespawnEvent despawnCheck = log.CombatData.GetDespawnEvents(AgentItem).LastOrDefault(); SpawnEvent spawnCheck = log.CombatData.GetSpawnEvents(AgentItem).LastOrDefault(); DeadEvent deathCheck = log.CombatData.GetDeadEvents(AgentItem).LastOrDefault(); AliveEvent aliveCheck = log.CombatData.GetAliveEvents(AgentItem).LastOrDefault(); if (AgentItem.Type != AgentItem.AgentType.EnemyPlayer && deathCheck != null && (aliveCheck == null || aliveCheck.Time < deathCheck.Time)) { CombatReplay.Trim(AgentItem.FirstAware, deathCheck.Time); } else if (despawnCheck != null && (spawnCheck == null || spawnCheck.Time < despawnCheck.Time)) { CombatReplay.Trim(AgentItem.FirstAware, despawnCheck.Time); } else { CombatReplay.Trim(AgentItem.FirstAware, AgentItem.LastAware); } return(true); } return(false); }
protected static void TrimCombatReplay(ParsedEvtcLog log, CombatReplay replay, AgentItem agentItem) { // Trim DespawnEvent despawnCheck = log.CombatData.GetDespawnEvents(agentItem).LastOrDefault(); SpawnEvent spawnCheck = log.CombatData.GetSpawnEvents(agentItem).LastOrDefault(); DeadEvent deathCheck = log.CombatData.GetDeadEvents(agentItem).LastOrDefault(); AliveEvent aliveCheck = log.CombatData.GetAliveEvents(agentItem).LastOrDefault(); if (deathCheck != null && (aliveCheck == null || aliveCheck.Time < deathCheck.Time)) { replay.Trim(agentItem.FirstAware, deathCheck.Time); } else if (despawnCheck != null && (spawnCheck == null || spawnCheck.Time < despawnCheck.Time)) { replay.Trim(agentItem.FirstAware, despawnCheck.Time); } else { replay.Trim(agentItem.FirstAware, agentItem.LastAware); } }
public DeathRecap(List <AbstractDamageEvent> damageLogs, DeadEvent dead, List <DownEvent> downs, List <AliveEvent> ups, long lastDeathTime) { DeathTime = dead.Time; DownEvent downed; AliveEvent upped = ups.LastOrDefault(x => x.Time <= dead.Time && x.Time >= lastDeathTime); if (upped != null) { downed = downs.LastOrDefault(x => x.Time <= dead.Time && x.Time >= upped.Time); } else { downed = downs.LastOrDefault(x => x.Time <= dead.Time && x.Time >= lastDeathTime); } if (downed != null) { var damageToDown = damageLogs.Where(x => x.Time > lastDeathTime && x.Time <= downed.Time && (x.HasHit || x.HasDowned) && x.Damage > 0).ToList(); ToDown = damageToDown.Count > 0 ? new List <DeathRecapDamageItem>() : null; int damage = 0; for (int i = damageToDown.Count - 1; i >= 0; i--) { AbstractDamageEvent dl = damageToDown[i]; AgentItem ag = dl.From; var item = new DeathRecapDamageItem() { Time = (int)dl.Time, IndirectDamage = dl is NonDirectDamageEvent, ID = dl.SkillId, Damage = dl.Damage, Src = ag != null?ag.Name.Replace("\u0000", "").Split(':')[0] : "" }; damage += dl.Damage; ToDown.Add(item); if (damage > 20000) { break; } } var damageToKill = damageLogs.Where(x => x.Time > downed.Time && x.Time <= dead.Time && (x.HasHit || x.HasDowned) && x.Damage > 0).ToList(); ToKill = damageToKill.Count > 0 ? new List <DeathRecapDamageItem>() : null; for (int i = damageToKill.Count - 1; i >= 0; i--) { AbstractDamageEvent dl = damageToKill[i]; AgentItem ag = dl.From; var item = new DeathRecapDamageItem() { Time = (int)dl.Time, IndirectDamage = dl is NonDirectDamageEvent, ID = dl.SkillId, Damage = dl.Damage, Src = ag != null?ag.Name.Replace("\u0000", "").Split(':')[0] : "" }; ToKill.Add(item); } } else { ToDown = null; var damageToKill = damageLogs.Where(x => x.Time > lastDeathTime && x.Time <= dead.Time && (x.HasHit || x.HasDowned) && x.Damage > 0).ToList(); ToKill = damageToKill.Count > 0 ? new List <DeathRecapDamageItem>() : null; int damage = 0; for (int i = damageToKill.Count - 1; i >= 0; i--) { AbstractDamageEvent dl = damageToKill[i]; AgentItem ag = dl.From; var item = new DeathRecapDamageItem() { Time = (int)dl.Time, IndirectDamage = dl is NonDirectDamageEvent, ID = dl.SkillId, Damage = dl.Damage, Src = ag != null?ag.Name.Replace("\u0000", "").Split(':')[0] : "" }; damage += dl.Damage; ToKill.Add(item); if (damage > 20000) { break; } } } }
internal DeathRecap(ParsedEvtcLog log, IReadOnlyList <AbstractHealthDamageEvent> damageLogs, DeadEvent dead, IReadOnlyList <DownEvent> downs, IReadOnlyList <AliveEvent> ups, long lastDeathTime) { DeathTime = dead.Time; DownEvent downed; AliveEvent upped = ups.LastOrDefault(x => x.Time <= dead.Time && x.Time >= lastDeathTime); if (upped != null) { downed = downs.LastOrDefault(x => x.Time <= dead.Time && x.Time >= upped.Time); } else { downed = downs.LastOrDefault(x => x.Time <= dead.Time && x.Time >= lastDeathTime); } if (downed != null) { var damageToDown = damageLogs.Where(x => x.Time > lastDeathTime && x.Time <= downed.Time && (x.HasHit || x.HasDowned)).ToList(); ToDown = damageToDown.Count > 0 ? new List <DeathRecapDamageItem>() : null; int damage = 0; for (int i = damageToDown.Count - 1; i >= 0; i--) { AbstractHealthDamageEvent dl = damageToDown[i]; AgentItem ag = dl.From; var item = new DeathRecapDamageItem() { Time = (int)dl.Time, IndirectDamage = dl is NonDirectHealthDamageEvent, ID = dl.SkillId, Damage = dl.HealthDamage, Src = log.FindActor(ag)?.Character }; damage += dl.HealthDamage; ToDown.Add(item); if (damage > 20000) { break; } } var damageToKill = damageLogs.Where(x => x.Time > downed.Time && x.Time <= dead.Time && (x.HasHit || x.HasKilled)).ToList(); ToKill = damageToKill.Count > 0 ? new List <DeathRecapDamageItem>() : null; for (int i = damageToKill.Count - 1; i >= 0; i--) { AbstractHealthDamageEvent dl = damageToKill[i]; AgentItem ag = dl.From; var item = new DeathRecapDamageItem() { Time = (int)dl.Time, IndirectDamage = dl is NonDirectHealthDamageEvent, ID = dl.SkillId, Damage = dl.HealthDamage, Src = log.FindActor(ag)?.Character }; ToKill.Add(item); } } else { ToDown = null; var damageToKill = damageLogs.Where(x => x.Time > lastDeathTime && x.Time <= dead.Time && (x.HasHit || x.HasKilled)).ToList(); ToKill = damageToKill.Count > 0 ? new List <DeathRecapDamageItem>() : null; int damage = 0; for (int i = damageToKill.Count - 1; i >= 0; i--) { AbstractHealthDamageEvent dl = damageToKill[i]; AgentItem ag = dl.From; var item = new DeathRecapDamageItem() { Time = (int)dl.Time, IndirectDamage = dl is NonDirectHealthDamageEvent, ID = dl.SkillId, Damage = dl.HealthDamage, Src = log.FindActor(ag)?.Character }; damage += dl.HealthDamage; ToKill.Add(item); if (damage > 20000) { break; } } } }