public static NPC GetNPCByName(string name) { return(NPCs.Find(x => x.Name.ToLower() == name.ToLower())); }
public static NPC GetNPCByName(string name) { return(NPCs.Find(x => x.Name == name)); }
private void FillMissingData() { // Update Instid foreach (Player p in Players) { foreach (Event e in Events) { if (p.Address == e.SrcAgent && e.SrcInstid != 0) { p.Instid = e.SrcInstid; } else if (p.Address == e.DstAgent && e.DstInstid != 0) { p.Instid = e.DstInstid; } } } foreach (NPC n in NPCs) { foreach (Event e in Events) { if (n.Address == e.SrcAgent && e.SrcInstid != 0) { n.Instid = e.SrcInstid; } else if (n.Address == e.DstAgent && e.DstInstid != 0) { n.Instid = e.DstInstid; } } } // Update Metadata IEnumerable <Event> sc = Events.Where(e => e.StateChange != StateChange.None); foreach (Event e in sc) { StateChange s = e.StateChange; if (s == StateChange.LogStart) { Metadata.LogStart = DateTimeOffset.FromUnixTimeSeconds(e.Value).DateTime; } else if (s == StateChange.LogEnd) { Metadata.LogEnd = DateTimeOffset.FromUnixTimeSeconds(e.Value).DateTime; } else if (s == StateChange.PointOfView) { Metadata.PointOfView = (Players.Find(p => p.Address == e.SrcAgent) != null) ? Players.Find(p => p.Address == e.SrcAgent).Account : ":?.????"; } else if (s == StateChange.Language) { Metadata.Language = (Language)e.Value; } else if (s == StateChange.GWBuild) { Metadata.GWBuild = int.Parse(e.SrcAgent, NumberStyles.HexNumber); } else if (s == StateChange.ShardID) { Metadata.ShardID = int.Parse(e.SrcAgent, NumberStyles.HexNumber); } } // Time normalization int ts = Events[0].Time; Events.ForEach(e => e.Time -= ts); // Target NPC tg = NPCs.Find(n => n.SpeciesId == Metadata.TargetSpeciesId); // Adjust instids of second half of Xera if (tg.SpeciesId == 16246) { NPC shx = NPCs.Find(n => n.SpeciesId == 16286); if (shx != null) { foreach (Event e in Events) { if (e.SrcInstid == shx.Instid) { e.SrcInstid = tg.Instid; } else if (e.DstInstid == shx.Instid) { e.DstInstid = tg.Instid; } else if (e.SrcMasterInstid == shx.Instid) { e.SrcMasterInstid = tg.Instid; } } } } // Set First/Last Aware for Target tg.FirstAware = Events.Where(e => e.SrcInstid == tg.Instid).First().Time; Event tde = Events.Find(e => e.StateChange == StateChange.ChangeDead && e.SrcInstid == tg.Instid); if (tde != null) { tg.LastAware = tde.Time; Events = Events.TakeWhile(e => !(e.StateChange == StateChange.ChangeDead && e.SrcInstid == tg.Instid)).ToList(); // Trim Events After Death } else { tg.LastAware = Events.Where(e => e.SrcInstid == tg.Instid).Last().Time; } }