public static void UpdateActor(DiaObject actor) { if (actor == null || !actor.IsValid) { return; } CachedActor cachedActor; if (Actors.TryGetValue(actor.ActorSNO, out cachedActor)) { cachedActor.Position = actor.Position; cachedActor.WorldId = _currentWorldId; cachedActor.LevelAreaId = _currentLevelAreaId; cachedActor.LastSeen = DateTime.UtcNow; } else { var newActor = new CachedActor { Position = actor.Position, WorldId = ZetaDia.CurrentWorldId, LastSeen = DateTime.UtcNow }; Actors.Add(actor.ActorSNO, newActor); } if (Actors.Count > 200) { Actors.Remove(Actors.ElementAt(0).Key); } }
public static void UpdateActor(DiaObject actor) { if (actor == null || !actor.IsValid) return; CachedActor cachedActor; if (Actors.TryGetValue(actor.ActorSNO, out cachedActor)) { cachedActor.Position = actor.Position; cachedActor.WorldId = _currentWorldId; cachedActor.LevelAreaId = _currentLevelAreaId; cachedActor.LastSeen = DateTime.UtcNow; } else { var newActor = new CachedActor { Position = actor.Position, WorldId = ZetaDia.CurrentWorldId, LastSeen = DateTime.UtcNow }; Actors.Add(actor.ActorSNO, newActor); } if (Actors.Count > 200) Actors.Remove(Actors.ElementAt(0).Key); }