private static void UpdateAgentData(AgentItem ag, long logTime, ushort instid) { if (ag.InstID == 0) { ag.SetInstid(instid); } if (ag.FirstAware == 0) { ag.OverrideAwareTimes(logTime, logTime); } else { ag.OverrideAwareTimes(ag.FirstAware, logTime); } }
private static void RegroupTargetsByID(int id, AgentData agentData, List <CombatItem> combatItems) { IReadOnlyList <AgentItem> agents = agentData.GetNPCsByID(id); if (agents.Count > 1) { AgentItem firstItem = agents.First(); var agentValues = new HashSet <ulong>(agents.Select(x => x.Agent)); var newTargetAgent = new AgentItem(firstItem); newTargetAgent.OverrideAwareTimes(agents.Min(x => x.FirstAware), agents.Max(x => x.LastAware)); agentData.SwapMasters(new HashSet <AgentItem>(agents), firstItem); agentData.OverrideID(id, newTargetAgent); foreach (CombatItem c in combatItems) { if (agentValues.Contains(c.SrcAgent) && c.IsStateChange.SrcIsAgent()) { c.OverrideSrcAgent(newTargetAgent.Agent); } if (agentValues.Contains(c.DstAgent) && c.IsStateChange.DstIsAgent()) { c.OverrideDstAgent(newTargetAgent.Agent); } } } }
private static void RegroupTargetsByID(int id, AgentData agentData, List <CombatItem> combatItems, IReadOnlyDictionary <uint, AbstractExtensionHandler> extensions) { IReadOnlyList <AgentItem> agents = agentData.GetNPCsByID(id); if (agents.Count > 1) { AgentItem firstItem = agents.First(); var agentValues = new HashSet <ulong>(agents.Select(x => x.Agent)); var newTargetAgent = new AgentItem(firstItem); newTargetAgent.OverrideAwareTimes(agents.Min(x => x.FirstAware), agents.Max(x => x.LastAware)); agentData.SwapMasters(new HashSet <AgentItem>(agents), newTargetAgent); agentData.ReplaceAgentsFromID(newTargetAgent); foreach (CombatItem c in combatItems) { if (agentValues.Contains(c.SrcAgent) && c.SrcIsAgent(extensions)) { c.OverrideSrcAgent(newTargetAgent.Agent); } if (agentValues.Contains(c.DstAgent) && c.DstIsAgent(extensions)) { c.OverrideDstAgent(newTargetAgent.Agent); } } } }
private static bool UpdateAgentData(AgentItem ag, long logTime, ushort instid, bool checkInstid) { if (instid != 0) { if (ag.InstID == 0) { ag.SetInstid(instid); } else if (checkInstid && ag.InstID != instid) { return(false); } } if (ag.FirstAware == 0) { ag.OverrideAwareTimes(logTime, logTime); } else { ag.OverrideAwareTimes(Math.Min(ag.FirstAware, logTime), Math.Max(ag.LastAware, logTime)); } return(true); }
public override void EIEvtcParse(FightData fightData, AgentData agentData, List <CombatItem> combatData, List <Player> playerList) { // find target AgentItem target = agentData.GetNPCsByID((int)ParseEnum.TargetIDS.Xera).FirstOrDefault(); if (target == null) { throw new InvalidOperationException("Error Encountered: Xera not found"); } // find split foreach (AgentItem NPC in agentData.GetAgentByType(AgentItem.AgentType.NPC)) { if (NPC.ID == 16286) { CombatItem move = combatData.FirstOrDefault(x => x.IsStateChange == ParseEnum.StateChange.Position && x.SrcAgent == NPC.Agent && x.Time >= NPC.FirstAware + 500); if (move != null) { _specialSplit = move.Time; } else { _specialSplit = NPC.FirstAware; } target.OverrideAwareTimes(target.FirstAware, NPC.LastAware); agentData.SwapMasters(NPC, target); var agents = new HashSet <ulong>() { NPC.Agent, target.Agent }; // update combat data foreach (CombatItem c in combatData) { if (agents.Contains(c.SrcAgent) && c.IsStateChange.SrcIsAgent()) { c.OverrideSrcAgent(target.Agent); } if (agents.Contains(c.DstAgent) && c.IsStateChange.DstIsAgent()) { c.OverrideDstAgent(target.Agent); } } break; } } ComputeFightTargets(agentData, combatData); }
internal override void EIEvtcParse(ulong gw2Build, FightData fightData, AgentData agentData, List <CombatItem> combatData, List <AbstractSingleActor> friendlies, IReadOnlyDictionary <uint, AbstractExtensionHandler> extensions) { // find target AgentItem firstXera = agentData.GetNPCsByID((int)ArcDPSEnums.TargetID.Xera).FirstOrDefault(); if (firstXera == null) { throw new MissingKeyActorsException("Xera not found"); } _xeraFirstPhaseEndTime = firstXera.LastAware; // var maxHPUpdates = combatData.Where(x => x.IsStateChange == ArcDPSEnums.StateChange.MaxHealthUpdate && x.DstAgent > 0).ToList(); // var bloodstoneFragments = maxHPUpdates.Where(x => x.DstAgent == 104580).Select(x => agentData.GetAgent(x.SrcAgent, x.Time)).Where(x => x.Type == AgentItem.AgentType.Gadget).ToList(); foreach (AgentItem gadget in bloodstoneFragments) { gadget.OverrideType(AgentItem.AgentType.NPC); gadget.OverrideID(ArcDPSEnums.TrashID.BloodstoneFragment); } // var bloodstoneShards = maxHPUpdates.Where(x => x.DstAgent == 343620).Select(x => agentData.GetAgent(x.SrcAgent, x.Time)).Where(x => x.Type == AgentItem.AgentType.Gadget).ToList(); foreach (AgentItem gadget in bloodstoneShards) { gadget.OverrideType(AgentItem.AgentType.NPC); gadget.OverrideID(ArcDPSEnums.TrashID.BloodstoneShard); } // var chargedBloodStones = maxHPUpdates.Where(x => x.DstAgent == 74700).Select(x => agentData.GetAgent(x.SrcAgent, x.Time)).Where(x => x.Type == AgentItem.AgentType.Gadget && x.LastAware > firstXera.LastAware).ToList(); foreach (AgentItem gadget in chargedBloodStones) { gadget.OverrideType(AgentItem.AgentType.NPC); gadget.OverrideID(ArcDPSEnums.TrashID.ChargedBloodstone); } if (bloodstoneFragments.Any() || bloodstoneShards.Any() || chargedBloodStones.Any()) { agentData.Refresh(); } // find split AgentItem secondXera = agentData.GetNPCsByID(16286).FirstOrDefault(); if (secondXera != null) { CombatItem move = combatData.FirstOrDefault(x => x.IsStateChange == ArcDPSEnums.StateChange.Position && x.SrcMatchesAgent(secondXera) && x.Time >= secondXera.FirstAware + 500); if (move != null) { _xeraSecondPhaseStartTime = move.Time; } else { _xeraSecondPhaseStartTime = secondXera.FirstAware; } firstXera.OverrideAwareTimes(firstXera.FirstAware, secondXera.LastAware); agentData.SwapMasters(secondXera, firstXera); // update combat data foreach (CombatItem c in combatData) { if (c.SrcMatchesAgent(secondXera, extensions)) { c.OverrideSrcAgent(firstXera.Agent); } if (c.DstMatchesAgent(secondXera, extensions)) { c.OverrideDstAgent(firstXera.Agent); } } } ComputeFightTargets(agentData, combatData, extensions); if (_xeraSecondPhaseStartTime > 0) { AbstractSingleActor mainTarget = GetMainTarget(); if (mainTarget == null) { throw new MissingKeyActorsException("Xera not found"); } mainTarget.SetManualHealth(24085950); } }
internal override void EIEvtcParse(FightData fightData, AgentData agentData, List <CombatItem> combatData, List <Player> playerList) { // find target AgentItem firstXera = agentData.GetNPCsByID((int)ArcDPSEnums.TargetID.Xera).FirstOrDefault(); if (firstXera == null) { throw new MissingKeyActorsException("Xera not found"); } var maxHPUpdates = combatData.Where(x => x.IsStateChange == ArcDPSEnums.StateChange.MaxHealthUpdate && x.DstAgent > 0).ToList(); var bloodstoneFragments = maxHPUpdates.Where(x => x.DstAgent == 104580).Select(x => agentData.GetAgent(x.SrcAgent)).Where(x => x.Type == AgentItem.AgentType.Gadget).ToList(); foreach (AgentItem gadget in bloodstoneFragments) { gadget.OverrideType(AgentItem.AgentType.NPC); gadget.OverrideID(ArcDPSEnums.TrashID.BloodstoneFragment); } var bloodstoneShards = maxHPUpdates.Where(x => x.DstAgent == 343620).Select(x => agentData.GetAgent(x.SrcAgent)).Where(x => x.Type == AgentItem.AgentType.Gadget).ToList(); foreach (AgentItem gadget in bloodstoneShards) { gadget.OverrideType(AgentItem.AgentType.NPC); gadget.OverrideID(ArcDPSEnums.TrashID.BloodstoneShard); } var chargedBloodStones = maxHPUpdates.Where(x => x.DstAgent == 74700).Select(x => agentData.GetAgent(x.SrcAgent)).Where(x => x.Type == AgentItem.AgentType.Gadget && x.LastAware > firstXera.LastAware).ToList(); foreach (AgentItem gadget in chargedBloodStones) { gadget.OverrideType(AgentItem.AgentType.NPC); gadget.OverrideID(ArcDPSEnums.TrashID.ChargedBloodstone); // they are actually present from start to finish gadget.OverrideAwareTimes(firstXera.LastAware + 15000, gadget.LastAware); } if (bloodstoneFragments.Any() || bloodstoneShards.Any() || chargedBloodStones.Any()) { agentData.Refresh(); } // find split AgentItem secondXera = agentData.GetNPCsByID(16286).FirstOrDefault(); if (secondXera != null) { CombatItem move = combatData.FirstOrDefault(x => x.IsStateChange == ArcDPSEnums.StateChange.Position && x.SrcAgent == secondXera.Agent && x.Time >= secondXera.FirstAware + 500); if (move != null) { _xeraSecondPhaseStartTime = move.Time; } else { _xeraSecondPhaseStartTime = secondXera.FirstAware; } firstXera.OverrideAwareTimes(firstXera.FirstAware, secondXera.LastAware); agentData.SwapMasters(secondXera, firstXera); // update combat data foreach (CombatItem c in combatData) { if (c.SrcAgent == secondXera.Agent && c.IsStateChange.SrcIsAgent()) { c.OverrideSrcAgent(firstXera.Agent); } if (c.DstAgent == secondXera.Agent && c.IsStateChange.DstIsAgent()) { c.OverrideDstAgent(firstXera.Agent); } } } ComputeFightTargets(agentData, combatData); }