public List <string> GetMapItems() { List <string> packets = new List <string>(); Sessions.Where(s => s.Character != null && !s.Character.InvisibleGm).ToList().ForEach(s => { s.Character.Mates.Where(m => m.IsTeamMember).ToList().ForEach(m => packets.Add(m.GenerateIn())); }); // TODO: Parallelize getting of items of mapinstance Portals.ForEach(s => packets.Add(s.GenerateGp())); ScriptedInstances.Where(s => s.Type == ScriptedInstanceType.TimeSpace).ToList().ForEach(s => packets.Add(s.GenerateWp())); Monsters.ForEach(s => { packets.Add(s.GenerateIn()); if (s.IsBoss) { packets.Add(s.GenerateBoss()); } }); Npcs.ForEach(s => packets.Add(s.GenerateIn())); packets.AddRange(GenerateNPCShopOnMap()); Parallel.ForEach(DroppedList.GetAllItems(), session => packets.Add(session.GenerateIn())); Buttons.ForEach(s => packets.Add(s.GenerateIn())); packets.AddRange(GenerateUserShops()); packets.AddRange(GeneratePlayerShopOnMap()); return(packets); }
public void RemoveMapItem() { // take the data from list to remove it without having enumeration problems (ToList) try { List <MapItem> dropsToRemove = DroppedList.GetAllItems().Where(dl => dl.CreatedDate.AddMinutes(3) < DateTime.Now).ToList(); foreach (MapItem drop in dropsToRemove) { Broadcast(drop.GenerateOut(drop.TransportId)); DroppedList.Remove(drop.TransportId); } } catch (Exception e) { Logger.Error(e); } }
public List <string> GetMapItems() { List <string> packets = new List <string>(); Sessions.Where(s => s.Character != null && !s.Character.InvisibleGm).ToList().ForEach(s => { s.Character.Mates.Where(m => m.IsTeamMember).ToList().ForEach(m => packets.Add(m.GenerateIn())); }); Portals.ForEach(s => packets.Add(s.GenerateGp())); TimeSpaces.ForEach(s => packets.Add(s.GenerateWp())); Monsters.ForEach(s => packets.Add(s.GenerateIn())); Npcs.ForEach(s => packets.Add(s.GenerateIn())); packets.AddRange(GenerateNPCShopOnMap()); DroppedList.GetAllItems().ForEach(s => packets.Add(s.GenerateIn())); Buttons.ForEach(s => packets.Add(s.GenerateIn())); packets.AddRange(GenerateUserShops()); packets.AddRange(GeneratePlayerShopOnMap()); return(packets); }