/// <summary> /// Find the corresponding actor, creates one otherwise /// </summary> /// <param name="agentItem"><see cref="AgentItem"/> to find an <see cref="AbstractSingleActor"/> for</param> /// <param name="excludePlayers">returns null if true and agentItem is a player or has a player master</param> /// <returns></returns> public AbstractSingleActor FindActor(AgentItem agentItem, bool excludePlayers = false) { if (agentItem == null || (excludePlayers && agentItem.GetFinalMaster().Type == AgentItem.AgentType.Player)) { return(null); } InitActorDictionaries(); if (!_agentToActorDictionary.TryGetValue(agentItem, out AbstractSingleActor actor)) { if (agentItem.Type == AgentItem.AgentType.Player) { actor = new Player(agentItem, true); _operation.UpdateProgressWithCancellationCheck("Found player " + actor.Character + " not in player list"); } else if (agentItem.Type == AgentItem.AgentType.NonSquadPlayer) { actor = new PlayerNonSquad(agentItem); } else { actor = new NPC(agentItem); } _agentToActorDictionary[agentItem] = actor; //throw new EIException("Requested actor with id " + a.ID + " and name " + a.Name + " is missing"); } return(actor); }
/// <summary> /// Find the corresponding actor, creates one otherwise /// </summary> /// <param name="agentItem"><see cref="AgentItem"/> to find an <see cref="AbstractSingleActor"/> for</param> /// <param name="excludePlayers">returns null if true and agentItem is a player or has a player master</param> /// <returns></returns> public AbstractSingleActor FindActor(AgentItem agentItem, bool excludePlayers = false) { if (agentItem == null || (excludePlayers && agentItem.GetFinalMaster().Type == AgentItem.AgentType.Player)) { return(null); } InitActorDictionaries(); if (!_agentToActorDictionary.TryGetValue(agentItem, out AbstractSingleActor actor)) { actor = new NPC(agentItem); _agentToActorDictionary[agentItem] = actor; //throw new EIException("Requested actor with id " + a.ID + " and name " + a.Name + " is missing"); } return(actor); }
protected override void InitAdditionalCombatReplayData(ParsedEvtcLog log) { log.FightData.Logic.ComputeNPCCombatReplayActors(this, log, CombatReplay); AgentItem master = AgentItem.GetFinalMaster(); if (CombatReplay.Rotations.Any() && (log.FightData.Logic.TargetAgents.Contains(AgentItem) || log.FriendlyAgents.Contains(AgentItem))) { CombatReplay.Decorations.Add(new FacingDecoration(((int)CombatReplay.TimeOffsets.start, (int)CombatReplay.TimeOffsets.end), new AgentConnector(this), CombatReplay.PolledRotations)); } if (master != AgentItem) { AbstractSingleActor masterActor = log.FindActor(master); // Basic linkage CombatReplay.Decorations.Add(new LineDecoration(0, ((int)CombatReplay.TimeOffsets.start, (int)CombatReplay.TimeOffsets.end), "rgba(0, 255, 0, 0.5)", new AgentConnector(this), new AgentConnector(masterActor))); // Prof specific treatment ProfHelper.ComputeMinionCombatReplayActors(this, masterActor, log, CombatReplay); } }
protected override AgentItem GetCasterAgent(AgentItem agent) { return(agent.GetFinalMaster()); }